JSPM

choo-redirect

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q20657F
  • License MIT

Redirect a view to another view

Package Exports

  • choo-redirect

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (choo-redirect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

choo-redirect stability

npm version build status test coverage downloads js-standard-style

Redirect a view to another view.

Usage

var redirect = require('choo-redirect')
var html = require('choo/html')
var choo = require('choo')

var app = choo()

app.route('/', redirect('/welcome'))
app.route('/welcome', welcomeView)

app.mount('body')

function welcomeView () {
  return html`
    <body>
      <div>welcome!</div>
    </body>
  `
}

API

view = redirect(route, rootSelector?)

Create a new view that redirects to a route. Can take an optional second argument for the root selector which is used as the entry point of the application. Defaults to document.body.

Installation

$ npm install choo-redirect

License

MIT