From abd2fc3e615c476a990fb079c36f9667225e9ef0 Mon Sep 17 00:00:00 2001 From: Moritz Date: Sun, 10 Feb 2019 12:56:07 +0100 Subject: [PATCH] Use window as global by default, fall back to eval --- src/builtIns/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/builtIns/index.js b/src/builtIns/index.js index b3737c0..14f55b7 100644 --- a/src/builtIns/index.js +++ b/src/builtIns/index.js @@ -1,7 +1,7 @@ import collectionHandlers from './collections' // eslint-disable-next-line -const globalObj = Function("return this")(); +const globalObj = typeof window === 'object' ? window : Function('return this')(); // built-in object can not be wrapped by Proxies // their methods expect the object instance as the 'this' instead of the Proxy wrapper