is-browser-window
isBrowserWindow()
Returns true
if the code is running within a Browser window. Use this function if you need special code paths for when running in a Browser window, a Web Worker, or another environment (such as Node.js).
var isBrowserWindow = require("can-globals/is-browser-window/is-browser-window");
var GLOBAL = require("can-globals/global/global");
if(isBrowserWindow()) {
console.log(GLOBAL() === window); // -> true
}
Returns
{Boolean}
:
True if the environment is a Browser window.