visionmedia / page.js

Micro client-side router inspired by the Express router
http://visionmedia.github.com/page.js
7.67k stars 687 forks source link

make sure _onpopstate is defined in non-browser environments #503

Closed flootr closed 5 years ago

flootr commented 5 years ago

fixes #501

Apparently the internal _onpopstate method isn't defined in environments where the window object doesn't exist such as test runners or Node.js. This PR adds a simple noop method to make sure it's defined.

I'm not aware of the internals of page.js and not sure if it causes any other side effects. I'm happy for feedback if this is actually a helpful fix.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 89.496% when pulling 05a41c944eb71233723ebe94a224c3c44e23f8e5 on flootr:patch-1 into f48d3f1ca10edc6847fca48c1ccfa74df86b9ef2 on visionmedia:master.

matthewp commented 5 years ago

Thanks!