New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

choo-lazy-route

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

choo-lazy-route

lazy load choo routes from split bundles

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

choo-lazy-route

var app = choo()
var splitRequire = require('split-require')
var lazyRoute = require('choo-lazy-route')()

app.use(lazyRoute)
app.route('/lazy-route', lazyRoute(function (cb) {
  splitRequire('./views/lazyView', cb)
}))

API

lazyRoute = require('choo-lazy-route')()

Create an instance of the lazy route manager.

app.use(lazyRoute)

Associate the lazy route manager with an app. The lazyRoute store also configures the app to take advantage of the experimental prefetch feature in bankai, so that server side rendering will include lazy routes.

app.route('/', lazyRoute(function load() {}))

Create a lazy route. The load function can return a Promise or use the callback in its first parameter.

Events

The lazy-route store emits the events listed below.

lazy-route:load(route)

Emitted when a route starts loading. route is a string.

lazy-route:loaded(route, view)

Emitted when a route has loaded successfully. route is a string. view is the view function that was loaded.

todo

  • timeout
  • loading view (show after 700ms or so)

Keywords

choo

FAQs

Package last updated on 23 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts