Add event shortcut methods

This commit is contained in:
MIZUNE Pine
2014-09-04 20:45:10 +09:00
parent 0d999bb466
commit 27305dfa79
2 changed files with 75 additions and 0 deletions
+6
View File
@@ -306,3 +306,9 @@ $.browser.playbook;
!!$.os.ios; // => true
!!$.os.version; // => "6.1"
!!$.browser.version; // => "536.26"
// shortcut methods for `.bind(event, fn)` for each event type
$('#example').click();
$('#example').click(() => {
alert('clicked');
});
+69
View File
@@ -1407,6 +1407,75 @@ interface ZeptoCollection {
**/
undelegate(selector: string, type: string, fn: (e: Event) => boolean): ZeptoCollection;
focusin(): ZeptoCollection;
focusin(fn: (e: Event) => any): ZeptoCollection;
focusout(): ZeptoCollection;
focusout(fn: (e: Event) => any): ZeptoCollection;
load(): ZeptoCollection;
load(fn: (e: Event) => any): ZeptoCollection;
resize(): ZeptoCollection;
resize(fn: (e: Event) => any): ZeptoCollection;
scroll(): ZeptoCollection;
scroll(fn: (e: Event) => any): ZeptoCollection;
unload(): ZeptoCollection;
unload(fn: (e: Event) => any): ZeptoCollection;
click(): ZeptoCollection;
click(fn: (e: Event) => any): ZeptoCollection;
dblclick(): ZeptoCollection;
dblclick(fn: (e: Event) => any): ZeptoCollection;
mousedown(): ZeptoCollection;
mousedown(fn: (e: Event) => any): ZeptoCollection;
mouseup(): ZeptoCollection;
mouseup(fn: (e: Event) => any): ZeptoCollection;
mousemove(): ZeptoCollection;
mousemove(fn: (e: Event) => any): ZeptoCollection;
mouseover(): ZeptoCollection;
mouseover(fn: (e: Event) => any): ZeptoCollection;
mouseout(): ZeptoCollection;
mouseout(fn: (e: Event) => any): ZeptoCollection;
mouseenter(): ZeptoCollection;
mouseenter(fn: (e: Event) => any): ZeptoCollection;
mouseleave(): ZeptoCollection;
mouseleave(fn: (e: Event) => any): ZeptoCollection;
change(): ZeptoCollection;
change(fn: (e: Event) => any): ZeptoCollection;
select(): ZeptoCollection;
select(fn: (e: Event) => any): ZeptoCollection;
keydown(): ZeptoCollection;
keydown(fn: (e: Event) => any): ZeptoCollection;
keypress(): ZeptoCollection;
keypress(fn: (e: Event) => any): ZeptoCollection;
keyup(): ZeptoCollection;
keyup(fn: (e: Event) => any): ZeptoCollection;
error(): ZeptoCollection;
error(fn: (e: Event) => any): ZeptoCollection;
focus(): ZeptoCollection;
focus(fn: (e: Event) => any): ZeptoCollection;
blur(): ZeptoCollection;
blur(fn: (e: Event) => any): ZeptoCollection;
/**
* Ajax
**/