All Projects → resonance-cascade → choo-location-electron

resonance-cascade / choo-location-electron

Licence: ISC license
A choo subscription that fixes routing in electron

Programming Languages

javascript
184084 projects - #8 most used programming language

choo-location-electron

A choo subscription that fixes routing in electron when loading a url from disk.

Build Status

WARNING: Doesn't work with choo 4 right now

See:

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 = require('choo')
const location = require('choo-location-electron')({ openExternal: true })
const app = choo()
app.model(location)

// rest of your app

const tree = app.start({ href: false }) //REQUIRED SETTINGS
document.body.appendChild(tree)

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
}

See also

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].