Skip to content

Commit

Permalink
fix(closure): don't throw at top-level scope
Browse files Browse the repository at this point in the history
Closure compiler does not allow this. We need this modification to use RxJS in Angular projects.

Addresses angular/tsickle#420
  • Loading branch information
alexeagle authored Apr 11, 2017
1 parent dc2e7f1 commit cafa477
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/util/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export const root: any = (
|| typeof global == 'object' && global.global === global && global
);

if (!root) {
throw new Error('RxJS could not find any global context (window, self, global)');
}
// Workaround Closure Compiler restriction: The body of a goog.module cannot use throw.
// Wrap in IIFE
(function () {
if (!root) {
throw new Error('RxJS could not find any global context (window, self, global)');
}
})();

0 comments on commit cafa477

Please sign in to comment.