Releases: Becklyn/javascript-router
Releases · Becklyn/javascript-router
1.0.3
1.0.2
1.0.1
1.0.0
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);