EvolvedWeb / evowc

Evolved Web Components
MIT License
8 stars 0 forks source link

Upgrade the `router onChange` to take a startsWith string #61

Closed intervalia closed 7 months ago

intervalia commented 11 months ago

Is your feature request related to a problem? Please describe. Currently onUpdate is only given a callback and there is no way for the router to on call the callbacks based on filtration

Describe the solution you'd like Add a second parameter that is a path filter. Then this callback with only happen if the path filter is met.

In this example, the function myFunc should only get called if the current path starts with "/mypath":

router.onUpdate(myFunc, '/mypath');

The filter could be a string or a regex to allow for better flexibility

intervalia commented 7 months ago

Will be in next release