-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak, sort of. Events get called multiple times #8
Comments
Same problem here. @lukeed this seems serious. |
RE: memory leak for There's not really a good way to handle multiple routers within the same page... currently. var main = (
navaid()
.on('/', () => console.log('Home'))
.on('/about', () => console.log('About'))
);
var items = (
navaid()
.on('/items/', () => console.log('Items Home'))
.on('/items/:title', x => console.log('Item: ', x.title))
);
main.use(items);
main.listen(); I already have this built, and it seems to be the only sane way to juggle multiple routers on a page. It's currently As for actual routing, it will look at the |
Fixed the memory leak. We can discuss multiple routers separately: #10 |
At the beginning of
listen
you wrap the history'spushState
andreplaceState
so they dispatch a function when called. The problem is, if you call unlisten and listen again, or have multiple instances ofnavaid
in the page, those wrapped functions get wrapped over and over and dispatch multiple events each page change.https://github.com/lukeed/navaid/blob/master/src/index.js#L43
The text was updated successfully, but these errors were encountered: