Allow multiple routers interaction#72
Conversation
rewrite for older NodeJS versions
| // Do not wrap if it's already wrapped | ||
| if(history[key].toString().indexOf('CustomEvent("pushstate"') !== -1){ | ||
| return function(){}; | ||
| } |
There was a problem hiding this comment.
I guess wrapping up a native history object was a bad idea initially...
There was a problem hiding this comment.
Well, it works well like it is now, but the thing is, you can't use the router 2 times completely separated, because you will wrap the object two times, then you will have 2 copies of every event.
|
I still need this change, and I need to rewrite it in node_modules everytime I deploy, so I'm going to fork and publish it to npm |
Codecov Report
@@ Coverage Diff @@
## master #72 +/- ##
==========================================
- Coverage 100% 98.59% -1.41%
==========================================
Files 6 6
Lines 68 71 +3
Branches 11 12 +1
==========================================
+ Hits 68 70 +2
- Misses 0 1 +1
Continue to review full report at Codecov.
|
Allow multiple routers to coexist by not wrapping the pushstate and replacestate functions multiple times and triggering the router listeners after creating it.