Skip to content

Commit

Permalink
Expose onclick so that it can be customized.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitar committed Nov 8, 2015
1 parent d9ca105 commit 51ef9a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
if (false === options.decodeURLComponents) decodeURLComponents = false;
if (false !== options.popstate) window.addEventListener('popstate', onpopstate, false);
if (false !== options.click) {
document.addEventListener(clickEvent, onclick, false);
document.addEventListener(clickEvent, page.onclick, false);
}
if (true === options.hashbang) hashbang = true;
if (!dispatch) return;
Expand All @@ -179,7 +179,7 @@
page.current = '';
page.len = 0;
running = false;
document.removeEventListener(clickEvent, onclick, false);
document.removeEventListener(clickEvent, page.onclick, false);
window.removeEventListener('popstate', onpopstate, false);
};

Expand Down Expand Up @@ -538,7 +538,7 @@
* Handle "click" events.
*/

function onclick(e) {
page.onclick = function(e) {

if (1 !== which(e)) return;

Expand Down Expand Up @@ -597,7 +597,7 @@

e.preventDefault();
page.show(orig);
}
};

/**
* Event button.
Expand Down
8 changes: 4 additions & 4 deletions page.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
if (false === options.decodeURLComponents) decodeURLComponents = false;
if (false !== options.popstate) window.addEventListener('popstate', onpopstate, false);
if (false !== options.click) {
document.addEventListener(clickEvent, onclick, false);
document.addEventListener(clickEvent, page.onclick, false);
}
if (true === options.hashbang) hashbang = true;
if (!dispatch) return;
Expand All @@ -181,7 +181,7 @@
page.current = '';
page.len = 0;
running = false;
document.removeEventListener(clickEvent, onclick, false);
document.removeEventListener(clickEvent, page.onclick, false);
window.removeEventListener('popstate', onpopstate, false);
};

Expand Down Expand Up @@ -538,7 +538,7 @@
* Handle "click" events.
*/

function onclick(e) {
page.onclick = function(e) {

if (1 !== which(e)) return;

Expand Down Expand Up @@ -597,7 +597,7 @@

e.preventDefault();
page.show(orig);
}
};

/**
* Event button.
Expand Down

0 comments on commit 51ef9a3

Please sign in to comment.