Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't leak global definitions where possible #155

Merged
merged 1 commit into from
Mar 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/interfaces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,4 @@ declare interface NodeRequire {
undef(moduleId: string, recursive?: boolean): void;
}

declare const arguments: IArguments;
declare var arguments: IArguments;
11 changes: 8 additions & 3 deletions src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import ModuleShim = DojoLoader.ModuleShim;
import Module = DojoLoader.Module;
import Package = DojoLoader.Package;

declare const load: (module: string) => any;
declare const Packages: {} | undefined;
declare const importScripts: ((url: string) => void);
// Nashorn global
declare var Packages: { [key: string]: any; } | undefined;

(function (args?: string[]): void {
let globalObject: any = (function (): any {
Expand All @@ -24,6 +23,12 @@ declare const importScripts: ((url: string) => void);
return {};
})();

// Nashorn global
const load: (module: string) => any = globalObject.load;

// webworker global
const importScripts: ((url: string) => void) = globalObject.importScripts;

const EXECUTING = 'executing';
const ABORT_EXECUTION: Object = {};
//
Expand Down