'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(, document.body); * }); * * Using HTML5 history and a custom "cursor" prop: * * Router.run(routes, Router.HistoryLocation, function (Handler) { * React.render(, 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;