Skip to content

Commit

Permalink
wip(okam-core): optimize app global init
Browse files Browse the repository at this point in the history
  • Loading branch information
wuhy committed Dec 27, 2018
1 parent 3dd5d4b commit 5e9c0cf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/okam-core/src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,15 @@ export function getGlobal() {
return self;
}

let result;
try {
if (typeof Function === 'function') {
return Function('return this')();
result = Function('return this')();
}
}
catch (e) {

// ignore exception
}

return (typeof global === 'object' && global) || this || {};
return result || (typeof global === 'object' && global) || this || {};
}

0 comments on commit 5e9c0cf

Please sign in to comment.