choo-location-electron
A choo subscription that fixes routing in electron when loading a url from disk.
Why?
When creating an electron browser window and loading the view from disk, choo
's router doesn't work out of the box due to the format of the resulting file://
url. choo-location-electron
provides a subscription that properly processes urls in href
attributes of a
tags so that they work with sheet-router properly.
Example
const choo = const location = openExternal: true const app = app // rest of your app const tree = appstart href: false //REQUIRED SETTINGSdocumentbody
Note: Setting href: false
is required in order to properly intercept click events on links.
API
var location = require('choo-location-electron')([opts])
Return a choo subscription that properly handles internal and optionally external links in electron.
Default options:
openExternal: false
openExternal
(Optional Boolean): intercept URLs and open them in a web browser usingrequire('electron').shell.openExternal
(see electron.atom.io/docs/api/shell/#shellopenexternalurl-options).