Skip to content

Commit

Permalink
Replace window with globalThis in browser runtime to support other ru…
Browse files Browse the repository at this point in the history
…ntimes as well. Fix #218 #203 #202
  • Loading branch information
terehov committed Mar 2, 2023
1 parent 040b960 commit 7018919
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/runtime/browser/index.ts
Expand Up @@ -19,7 +19,7 @@ export interface IMeta extends IMetaStatic {

const meta: IMetaStatic = {
runtime: "Browser",
browser: window?.["navigator"].userAgent,
browser: globalThis?.["navigator"].userAgent,
};

const pathRegex = /(?:(?:file|https?|global code|[^@]+)@)?(?:file:)?((?:\/[^:/]+){2,})(?::(\d+))?(?::(\d+))?/;
Expand Down Expand Up @@ -59,7 +59,7 @@ export function getErrorTrace(error: Error): IStackFrame[] {
}

function stackLineToStackFrame(line?: string): IStackFrame {
const href = window.location.origin;
const href = globalThis.location.origin;
const pathResult: IStackFrame = {
fullFilePath: undefined,
fileName: undefined,
Expand Down

0 comments on commit 7018919

Please sign in to comment.