Skip to content

Commit

Permalink
[fix] global is not defined (#160)
Browse files Browse the repository at this point in the history
* global is not defined #119
* better handling of global
* Co-Authored-By: benland <[email protected]>
* globalVar is always defined
* Co-Authored-By: benland <[email protected]>
  • Loading branch information
benland authored and 3rd-Eden committed Nov 5, 2018
1 parent 9fb86cf commit 7781ad8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,17 @@ var ignore = { hash: 1, query: 1 };
* @public
*/
function lolcation(loc) {
var location = global && global.location || {};
var globalVar;

if (typeof window !== 'undefined')
globalVar = window;
else if (typeof global !== 'undefined')
globalVar = global;
else if (typeof self !== 'undefined')
globalVar = self;
else
globalVar = {};
var location = globalVar.location || {};
loc = loc || location;

var finaldestination = {}
Expand Down

0 comments on commit 7781ad8

Please sign in to comment.