-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert plugin-browser-context to TypeScript
- Loading branch information
1 parent
0b18a5e
commit 8aaaf95
Showing
6 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import createRollupConfig from "../../.rollup/index.mjs"; | ||
|
||
export default createRollupConfig({ | ||
input: "src/context.ts" | ||
}); |
7 changes: 5 additions & 2 deletions
7
packages/plugin-browser-context/context.js → ...ges/plugin-browser-context/src/context.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import { Plugin } from '@bugsnag/core' | ||
|
||
/* | ||
* Sets the default context to be the current URL | ||
*/ | ||
module.exports = (win = window) => ({ | ||
load: (client) => { | ||
export default (win = window): Plugin => ({ | ||
load: client => { | ||
client.addOnError(event => { | ||
if (event.context !== undefined) return | ||
event.context = win.location.pathname | ||
// @ts-expect-error second parameter is private API | ||
}, true) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": ["src/**/*.ts"], | ||
"compilerOptions": { | ||
"target": "ES2020" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters