Skip to content

🎧 Listen for url changes without using a timer

License

Notifications You must be signed in to change notification settings

Tram-One/url-listener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

url-listener

Downloads Version License

Listen for url changes without using a timer

Install

You can install url-listener with npm like any other package.

npm install --save url-listener

You can also include the umd distributable in your webpage directly with a script tag.

<head>
  <script src="https://unpkg.com/[email protected]/dist/url-listener.umd.js" />
</head>

Usage

const urlListener = require('url-listener')

urlListener(event => {
  // your logic here!
  console.log('URL UPDATED!')
})

Notes

Events may overlap and be called more than once, so whatever callback you pass in should be idempotent (that is, hitting it multiple times is the same as hitting it once, like an elevator or cross-walk button).

Development

First, clone this repository, and install the dependencies.

git clone https://github.com/JRJurman/url-listener
cd url-listener
npm install

You can build the project by running the build script

npm run build

You can run the tests (which use a combination of NightmareJS and Jasmine)

npm test

PRs Welcome!

About

🎧 Listen for url changes without using a timer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published