current
Check if data represents the current route.
route.current(data [,subsetMatch] )
Compares data
to the current route. Used to verify if an object is
representative of the current route.
route.data.set({page: "recipes", id: '5'});
route.current({page: "recipes"}); //-> false
route.current({page: "recipes"}, true); //-> true
Parameters
- data
{Object}
:Data to check agains the current route.
- subsetMatch
{Boolean}
:If true,
route.current
will return true if every value indata
matches the current route data, even if the route data has additional properties that are not matched. Defaults tofalse
where every property needs to be present.
Returns
{Boolean}
:
Whether the data matches the current URL.
Use
Checks the page’s current URL to see if the route represents the options passed into the function.
Returns true if the options represent the current URL.
route.data.id = 5; // location.hash -> "#!id=5"
route.current({ id: 5 }); // -> true
route.current({ id: 5, type: 'videos' }); // -> false
route.data.type = 'videos';
// location.hash -> #!id=5&type=videos
route.current({ id: 5, type: 'videos' }); // -> true