Skip to content

Commit

Permalink
Add polyfill for global
Browse files Browse the repository at this point in the history
  • Loading branch information
svaarala committed Jan 2, 2017
1 parent 57df55e commit 9a1aa62
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions polyfills/global.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Duktape 2.1.0 adds a 'global' binding. Polyfill for earlier versions.
*/

if (typeof global === 'undefined') {
(function () {
var global = new Function('return this;')();
Object.defineProperty(global, 'global', {
value: global,
writable: true,
enumerable: false,
configurable: true
});
})();
}
1 change: 1 addition & 0 deletions util/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ def main():

copy_files([
'console-minimal.js',
'global.js',
'object-prototype-definegetter.js',
'object-prototype-definesetter.js',
'object-assign.js',
Expand Down

0 comments on commit 9a1aa62

Please sign in to comment.