diff --git a/package.json b/package.json index 50cbbba..0aa7cb6 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,6 @@ }, "homepage": "https://github.com/4Catalyzer/farce#readme", "dependencies": { - "dom-helpers": "^3.4.0", "invariant": "^2.2.4", "is-promise": "^2.1.0", "query-string": "^5.1.1", diff --git a/src/BrowserProtocol.js b/src/BrowserProtocol.js index 10402ad..0076c72 100644 --- a/src/BrowserProtocol.js +++ b/src/BrowserProtocol.js @@ -1,5 +1,3 @@ -import off from 'dom-helpers/events/off'; -import on from 'dom-helpers/events/on'; import invariant from 'invariant'; import createPath from './utils/createPath'; @@ -41,8 +39,8 @@ export default class BrowserProtocol { // TODO: On most versions of IE, we need a hashChange listener for hash- // only changes. - on(window, 'popstate', onPopState); - return () => off(window, 'popstate', onPopState); + window.addEventListener('popstate', onPopState); + return () => window.removeEventListener('popstate', onPopState); } transition(location) { diff --git a/src/HashProtocol.js b/src/HashProtocol.js index 0240e1b..90c3190 100644 --- a/src/HashProtocol.js +++ b/src/HashProtocol.js @@ -1,5 +1,3 @@ -import off from 'dom-helpers/events/off'; -import on from 'dom-helpers/events/on'; import invariant from 'invariant'; import StateStorage from './StateStorage'; @@ -42,8 +40,8 @@ export default class HashProtocol { listener(this.init()); }; - on(window, 'hashchange', onHashChange); - return () => off(window, 'hashchange', onHashChange); + window.addEventListener('hashchange', onHashChange); + return () => window.removeEventListener('hashchange', onHashChange); } transition(location) { diff --git a/src/createTransitionHookMiddleware.js b/src/createTransitionHookMiddleware.js index fc51ded..1846881 100644 --- a/src/createTransitionHookMiddleware.js +++ b/src/createTransitionHookMiddleware.js @@ -1,5 +1,3 @@ -import off from 'dom-helpers/events/off'; -import on from 'dom-helpers/events/on'; import isPromise from 'is-promise'; import warning from 'warning'; @@ -115,7 +113,7 @@ export default function createTransitionHookMiddleware({ return resultSafe; }; - on(window, 'beforeunload', onBeforeUnload); + window.addEventListener('beforeunload', onBeforeUnload); } return next(action); @@ -207,7 +205,7 @@ export default function createTransitionHookMiddleware({ } case ActionTypes.DISPOSE: if (onBeforeUnload) { - off(window, 'beforeunload', onBeforeUnload); + window.removeEventListener('beforeunload', onBeforeUnload); onBeforeUnload = null; } diff --git a/yarn.lock b/yarn.lock index 2fc33ee..8acf255 100644 --- a/yarn.lock +++ b/yarn.lock @@ -847,7 +847,7 @@ "@babel/plugin-transform-react-jsx-self" "^7.8.3" "@babel/plugin-transform-react-jsx-source" "^7.8.3" -"@babel/runtime@^7.1.2", "@babel/runtime@^7.6.3": +"@babel/runtime@^7.6.3": version "7.7.7" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.7.tgz#194769ca8d6d7790ec23605af9ee3e42a0aa79cf" integrity sha512-uCnC2JEVAu8AKB5do1WRIsvrdJ0flYx/A/9f/6chdacnEZ7LmavjdsDXr5ksYBegxtuTPR5Va9/+13QF/kFkCA== @@ -2476,13 +2476,6 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -dom-helpers@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.4.0.tgz#e9b369700f959f62ecde5a6babde4bccd9169af8" - integrity sha512-LnuPJ+dwqKDIyotW1VzmOZ5TONUN7CwkCR5hrgawTUbkBGYdeoNLZo6nNfGkCrjtE1nXXaj7iMMpDa8/d9WoIA== - dependencies: - "@babel/runtime" "^7.1.2" - dom-serialize@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/dom-serialize/-/dom-serialize-2.2.1.tgz#562ae8999f44be5ea3076f5419dcd59eb43ac95b"