Created
September 18, 2018 08:51
-
-
Save rishoej/5ba85a75e80fa07ba5fee47ec762e1d0 to your computer and use it in GitHub Desktop.
Monkey patch window.location.origin with typescript
This file contains 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
if (!window.location.origin) { | |
// window.location.origin is "readonly", not sure how to overwrite that so use any type for this. | |
const wl: any = window.location | |
const port = wl.port ? `:${wl.port}` : '' | |
wl.origin = `${wl.protocol}//${wl.hostname}${port}` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment