6.2.0 • Published 9 years ago
react-wildcat-ensure v6.2.0
react-wildcat-ensure
A wrapper for System.import that behaves like Webpack's require.ensure:
- initial import calls are asynchronous
- subsequent import calls returns a synchronous cached import response
Designed for compatibility with React Router's asynchronous route loading.
Installation
jspm:
jspm install react-wildcat-ensurenpm:
npm install react-wildcat-ensureUsage
Importing a single module:
import ensure from "react-wildcat-ensure";
// Lazy loaded component
export function getComponent(location, cb) {
ensure("./AsyncComponent.js", module, (err, module) => {
return cb(err, module);
});
}Importing a key/value hash of modules:
import ensure from "react-wildcat-ensure";
// Lazy loaded index route
export function getIndexRoute(location, cb) {
ensure({
header: "./AsyncHeader.js",
component: "./AsyncComponent.js"
}, module, (err, modules) => {
return cb(err, modules);
});
}Importing an array of modules:
import ensure from "react-wildcat-ensure";
// Lazy loaded child routes
export function getChildRoutes(location, cb) {
ensure([
"./AsyncChildRouteOne.js",
"./AsyncChildRouteTwo.js"
], module, (err, modules) => {
return cb(err, modules);
});
}License
MIT
6.2.0
9 years ago
6.0.0
9 years ago
5.0.0
10 years ago
4.1.0
10 years ago
4.0.0
10 years ago
3.0.0
10 years ago
2.4.4
10 years ago
2.0.0
10 years ago
1.0.0
10 years ago
1.0.0-rc8
10 years ago
1.0.0-rc7
10 years ago
1.0.0-rc6
10 years ago
1.0.0-rc5
10 years ago
1.0.0-rc4
10 years ago
1.0.0-rc3
10 years ago
1.0.0-rc2
10 years ago
1.0.0-rc1
10 years ago
1.0.0-beta10
10 years ago
1.0.0-beta9
10 years ago
1.0.0-beta8
10 years ago
1.0.0-beta7
10 years ago
1.0.0-beta6
10 years ago
1.0.0-beta5
10 years ago
1.0.0-beta4
10 years ago
1.0.0-beta3
10 years ago