Module: observer/urlobserver

urlobserver observes the URL the user is currently on. It maintains a list of functions that are triggered as soon as the URL is changed in the address bar.

Example

urlobserver is extremely easy to require and use. One such implementation is as follows:

var urlobserver = require('urlobserver.js');
urlobserver();
urlObserver.addCallback(function(url) {
	console.log("The new URL is "+url);
});

Methods


<inner> addCallback()

Adds callback function to the urlobserver. These functions are executed synchronously after the URL changes.
The function can have one argument, the new URL the page goes to.

<inner> initializeObserver()

Initializes the URL Observer.
Only one call is needed in the entire page.

<inner> observer()

The observer passed to MutationObserver that checks for new URL and if change occurs, executes all functions in the list.