finnsson / pagerjs

The Single Page Application Framework for KnockoutJS
http://pagerjs.com/
MIT License
271 stars 68 forks source link

Multiple functions to route guards #204

Closed stormpat closed 7 years ago

stormpat commented 9 years ago

Would be useful if you could pass an array of functions to a guard/beforeShow etc. this way each route could compose what kind of validation/methods should run.

Something like:

<div data-bind="page: { id: 'somePage', guard: 'validate, doAsync, finalize' }" ></div>

or as an array

<div data-bind="page: { id: 'somePage', guard: [validate, doAsync, finalize] }" ></div>

stormpat commented 9 years ago

I actually already implemented this, its very straight forward (using jQuery as its a hard dependency). I was thinking about doing a another solution with promises, but im not sure if its necessary, as guards mostly just check for some flag to be true or false.

I could make a PR, still have to write tests.

finnsson commented 9 years ago

Sounds good. Please send a PR.

DKhalil commented 7 years ago

This is already merged, closing!