Skip to content

Commit c48f690

Browse files
committed
Expose onclick so that it can be customized.
1 parent d9ca105 commit c48f690

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
if (false === options.decodeURLComponents) decodeURLComponents = false;
161161
if (false !== options.popstate) window.addEventListener('popstate', onpopstate, false);
162162
if (false !== options.click) {
163-
document.addEventListener(clickEvent, onclick, false);
163+
document.addEventListener(clickEvent, page.onclick, false);
164164
}
165165
if (true === options.hashbang) hashbang = true;
166166
if (!dispatch) return;
@@ -179,7 +179,7 @@
179179
page.current = '';
180180
page.len = 0;
181181
running = false;
182-
document.removeEventListener(clickEvent, onclick, false);
182+
document.removeEventListener(clickEvent, page.onclick, false);
183183
window.removeEventListener('popstate', onpopstate, false);
184184
};
185185

@@ -538,7 +538,7 @@
538538
* Handle "click" events.
539539
*/
540540

541-
function onclick(e) {
541+
page.onclick = function(e) {
542542

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

page.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
if (false === options.decodeURLComponents) decodeURLComponents = false;
163163
if (false !== options.popstate) window.addEventListener('popstate', onpopstate, false);
164164
if (false !== options.click) {
165-
document.addEventListener(clickEvent, onclick, false);
165+
document.addEventListener(clickEvent, page.onclick, false);
166166
}
167167
if (true === options.hashbang) hashbang = true;
168168
if (!dispatch) return;
@@ -181,7 +181,7 @@
181181
page.current = '';
182182
page.len = 0;
183183
running = false;
184-
document.removeEventListener(clickEvent, onclick, false);
184+
document.removeEventListener(clickEvent, page.onclick, false);
185185
window.removeEventListener('popstate', onpopstate, false);
186186
};
187187

@@ -538,7 +538,7 @@
538538
* Handle "click" events.
539539
*/
540540

541-
function onclick(e) {
541+
page.onclick = function(e) {
542542

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

0 commit comments

Comments
 (0)