Last active
June 3, 2020 19:46
-
-
Save RubaXa/078395065c3aa0ffee557fe072a70c57 to your computer and use it in GitHub Desktop.
globalThis globalLocation &
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const noop = () => {}; | |
export const nativeGlobalThis = (0 | |
|| typeof globalThis === 'object' && globalThis | |
|| typeof window === 'object' && window | |
|| typeof global === 'object' && global | |
|| {} | |
) as Window; | |
export const globalLocation = nativeGlobalThis.location || { | |
href: '', | |
hash: '', | |
host: '', | |
hostname: '', | |
search: '', | |
pathname: '', | |
protocol: 'https://', | |
port: '80', | |
origin: '', | |
assign: noop, | |
reload: noop, | |
replace: noop, | |
toString() { | |
return this.href; | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment