get()

in packages/core/browser-vm/src/Window.js [55:96]


      get(target, name) {
        if (externals.includes(name)) {
          const windowValue = window[name];
          if (typeof windowValue === 'function' && !isBoundedFunction(windowValue) && !isConstructable(windowValue)) {
            const bindFn = windowValue.bind(window);
            for (const key in windowValue) {
              bindFn[key] = windowValue[key];
            }
            return bindFn;
          } else {
            return windowValue;
          }
        }

        switch (name) {
          // case 'window':
          //   return getContextWindow(context);
          case 'document':
            return context.document;
          case 'location':
            return context.location;
          case 'history':
            return context.history;
          case '__CONSOLE_OS_GLOBAL_VARS_':
            return __CONSOLE_OS_GLOBAL_VARS_;
          case 'addEventListener':
            return addEventListener(context);
          case 'removeEventListener':
            return removeEventListener(context);
        }

        if (__CONSOLE_OS_GLOBAL_VARS_[name]) {
          return __CONSOLE_OS_GLOBAL_VARS_[name];
        }

        const value = target[name];
        if (typeof value === 'function' && !isBoundedFunction(value) && !isConstructable(value)) {
          return value.bind && value.bind(target);
        } else {
          return value;
        }
      },