Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2014-01-19 03:41:55 +0400
committerFeross Aboukhadijeh <feross@feross.org>2014-01-19 03:42:19 +0400
commite394c918b1bd8d6aadd5f45d9b94892f48f8a833 (patch)
treefefa4d685c463c49a5b1e74c7419e022709d7b20 /index.js
parent8a460e81f2fde2891173eeb97a7b2f5cc49345d1 (diff)
don't assume window exists (it doesn't in node)
Diffstat (limited to 'index.js')
-rw-r--r--index.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/index.js b/index.js
index 8ffec55..c28a4a8 100644
--- a/index.js
+++ b/index.js
@@ -14,7 +14,8 @@ var magnet = require('magnet-uri')
var net = require('net')
var Swarm = require('bittorrent-swarm')
-var isChromeApp = !!(window.chrome && chrome.app && chrome.app.runtime)
+var isChromeApp = !!(typeof window !== 'undefined' && window.chrome &&
+ chrome.app && chrome.app.runtime)
if (isChromeApp) {
console.log('This is a Chrome App')
}