proxy-based Twister client written with react-js
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

50 lines
1.2 KiB

"use strict";
var createRouter = require("./createRouter");
/**
* A high-level convenience method that creates, configures, and
* runs a router in one shot. The method signature is:
*
* Router.run(routes[, location ], callback);
*
* Using `window.location.hash` to manage the URL, you could do:
*
* Router.run(routes, function (Handler) {
* React.render(<Handler/>, document.body);
* });
*
* Using HTML5 history and a custom "cursor" prop:
*
* Router.run(routes, Router.HistoryLocation, function (Handler) {
* React.render(<Handler cursor={cursor}/>, document.body);
* });
*
* Returns the newly created router.
*
* Note: If you need to specify further options for your router such
* as error/abort handling or custom scroll behavior, use Router.create
* instead.
*
* var router = Router.create(options);
* router.run(function (Handler) {
* // ...
* });
*/
function runRouter(routes, location, callback) {
if (typeof location === "function") {
callback = location;
location = null;
}
var router = createRouter({
routes: routes,
location: location
});
router.run(callback);
return router;
}
module.exports = runRouter;