https://github.com/tram-one/url-listener
🎧 Listen for url changes without using a timer
https://github.com/tram-one/url-listener
Last synced: 9 months ago
JSON representation
🎧 Listen for url changes without using a timer
- Host: GitHub
- URL: https://github.com/tram-one/url-listener
- Owner: Tram-One
- License: mit
- Created: 2017-06-26T01:21:24.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-05-07T06:05:48.000Z (about 8 years ago)
- Last Synced: 2025-08-15T03:37:18.263Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 105 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# url-listener
Listen for url changes without using a timer
## Install
You can install url-listener with npm like any other package.
```bash
npm install --save url-listener
```
You can also include the umd distributable in your webpage directly with a
script tag.
```html
```
## Usage
```javascript
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.
```sh
git clone https://github.com/JRJurman/url-listener
cd url-listener
npm install
```
You can build the project by running the build script
```sh
npm run build
```
You can run the tests (which use a combination of NightmareJS and Jasmine)
```sh
npm test
```
PRs Welcome!