Skip to content

Instantly share code, notes, and snippets.

@akrisiun
Created February 17, 2021 14:28
Show Gist options
  • Save akrisiun/e2a90b8e5e1f0d029a3de8b61999446f to your computer and use it in GitHub Desktop.
Save akrisiun/e2a90b8e5e1f0d029a3de8b61999446f to your computer and use it in GitHub Desktop.
location.hash.slice + JSON.parse(decodeURIComponent - as window.__args__

parseHash_URIComponent - for NodeJs / Electron

// executed in context of window renderer
function parseArgs () {
  if (!window.location.hash) {
    window.__args__ = {}
  } else {
    var hash = window.location.hash.slice(1)
    window.__args__ = Object.freeze(JSON.parse(decodeURIComponent(hash)))
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment