From b2912ee7268be0848000c75cbb5ad207f03951aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cardoso?= Date: Wed, 28 Aug 2013 17:10:55 +0100 Subject: [PATCH] Allow purl to eval in a non-browser environment During the build process of a project I'm working on, purl gets evaled by https://github.com/jrburke/r.js, which is running on node, and as such there is no window object. This commit makes some very small changes to allow purl to eval and to work on a non-browser environment, namely it does not require `window` to exist. --- purl.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/purl.js b/purl.js index b5799c6..b2077cf 100644 --- a/purl.js +++ b/purl.js @@ -9,7 +9,7 @@ if (typeof define === 'function' && define.amd) { define(factory); } else { - window.purl = factory(); + this.purl = factory(); } })(function() { @@ -260,7 +260,9 @@ } }; - purl.jQuery(window.jQuery); + if ( typeof window !== 'undefined' ) { + purl.jQuery(window.jQuery); + } return purl;