🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

detect-url-change

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-url-change

Easily detect changes in the browser URL. Works with any method that changes the URL without reloading the page, such as `history.pushState()`, `history.replaceState()`, `history.back()`, etc.

1.0.2
latest
Source
npm
Version published
Weekly downloads
232
33.33%
Maintainers
1
Weekly downloads
 
Created
Source

detect-url-change

Easily detect changes in the browser URL. Works with any method that changes the URL without reloading the page, such as history.pushState(), history.replaceState(), history.back(), etc.

Usage

import detectUrlChange from 'detect-url-change';
detectUrlChange.on('change', (newUrl) => {
  console.log(`URL changed: ${newUrl}`);
});

API

detectUrlChange (default export)

The target object we can observe to detect URL changes.

Type: URLChangeEvent.

URLChangeEvent

Instance methods

on(event: 'change', listener: (newUrl: string) => void)

Call with callback to invoke callback on URL change.

off(event: 'change', listener: (newUrl: string) => void)

Call with event listener (callback) to unregister event listener for the change event.

Keywords

detect

FAQs

Package last updated on 12 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts