Skip to content
This repository has been archived by the owner on Apr 29, 2023. It is now read-only.

Allow multiple routers interaction #72

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kidandcat
Copy link

Allow multiple routers to coexist by not wrapping the pushstate and replacestate functions multiple times and triggering the router listeners after creating it.

@kidandcat kidandcat mentioned this pull request May 2, 2018
rewrite for older NodeJS versions
// Do not wrap if it's already wrapped
if(history[key].toString().indexOf('CustomEvent("pushstate"') !== -1){
return function(){};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess wrapping up a native history object was a bad idea initially...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kidandcat
Copy link
Author

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
Copy link

codecov bot commented May 15, 2018

Codecov Report

Merging #72 into master will decrease coverage by 1.4%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/location.js 95.45% <66.66%> (-4.55%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8db6747...d5d5f15. Read the comment docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants