Merge pull request #1587 from DotNetNerd/master

Added domready and domdelegate
This commit is contained in:
John Reilly
2014-01-24 01:17:34 -08:00
4 changed files with 40 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
/// <reference path="domready.d.ts" />
domready(function () {
// dom is loaded!
})
+6
View File
@@ -0,0 +1,6 @@
// Type definitions for domready
// Project: https://github.com/ded/domready
// Definitions by: Christian Holm Nielsen
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare function domready(callback: () => any) : void;
+15
View File
@@ -0,0 +1,15 @@
/// <reference path="ftdomdelegate.d.ts" />
window.addEventListener('load', function() {
var delegate = new Delegate(document.body);
delegate.on('click', 'button', function(event) {
// Do some things
}
);
// Listen to all touch move
// events that reach the body
delegate.on('touchmove', function(event) {
// Do some other things
});
}, false);
+14
View File
@@ -0,0 +1,14 @@
// Type definitions for ftdomdelegate
// Project: https://github.com/ftlabs/ftdomdelegate
// Definitions by: Christian Holm Nielsen
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare class Delegate
{
constructor(element: HTMLElement);
on(eventType: string, selector: string, callback : (event : any) => any) : void;
on(eventType: string, callback:(event : any) => any) : void;
}