@becklyn/router
v1.0.3
Published
The JS implementation of Symfony's Router.
Downloads
6
Maintainers
Keywords
Readme
Symfony JavaScript Router
This is a modern implementation of the JS router for generation Symfony routes. Best to be used with the JavaScript routing bundle.
Initialization
For example like this (using mojave
):
import {initFromGlobalData} from "mojave/init";
import {Router} from "@becklyn/router";
let router = initFromGlobalData("RouterInit", new Router());
A manual way to wire it up to global data is like this:
function loadGlobalData (key, handler)
{
if (undefined === window[key])
{
return;
}
// replace global callback
window[key].init = (data) => handler.init(data);
// handle current data
handler.init(window[key].data);
}
let router = new Router();
loadGlobalData("RouterInit", router);