mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-10 11:40:16 +08:00
@@ -0,0 +1,22 @@
|
||||
/// <reference path="fastclick.d.ts" />
|
||||
|
||||
// on browser
|
||||
new FastClick(document.body);
|
||||
new FastClick(document.getElementById('foo'), {tapDelay: 50});
|
||||
new FastClick(document.getElementsByTagName('p')[0], {touchBoundary: 50});
|
||||
var fc = FastClick.attach(document.body);
|
||||
fc.determineEventType(document.getElementsByClassName('foo')).concat('bar');
|
||||
fc.findControl(document.querySelector('label'));
|
||||
fc.focus(document.querySelectorAll('section')[0]);
|
||||
document.body.addEventListener('click', function(e) {
|
||||
fc.getTargetElementFromEventTarget(e.target);
|
||||
fc.needsClick(e.target);
|
||||
fc.needsFocus(e.target);
|
||||
});
|
||||
|
||||
// on CommonJS environment
|
||||
import fastclick = require('fastclick');
|
||||
fastclick(document.body);
|
||||
new fastclick.FastClick(document.links[0]);
|
||||
new fastclick.FastClick(document.links[1], {tapDelay: 50});
|
||||
new fastclick.FastClick(document.links[2], {touchBoundary: 50});
|
||||
Vendored
+44
@@ -0,0 +1,44 @@
|
||||
// Type definitions for FastClick v1.0.3
|
||||
// Project: https://github.com/ftlabs/fastclick
|
||||
// Definitions by: Shinnosuke Watanabe <https://github.com/shinnn>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface FastClickObject {
|
||||
lastTouchIdentifier: number;
|
||||
layer: Element;
|
||||
tapDelay: number;
|
||||
targetElement: any;
|
||||
touchBoundary: number;
|
||||
touchStartX: number;
|
||||
touchStartY: number;
|
||||
trackingClick: boolean;
|
||||
trackingClickStart: number;
|
||||
destroy(): void;
|
||||
determineEventType(targetElement: any): string;
|
||||
findControl(labelElement: any /* EventTarget | HTMLLabelElement */): any;
|
||||
focus(targetElement: any /* EventTarget | Element */): void;
|
||||
getTargetElementFromEventTarget(eventTarget: EventTarget): any;
|
||||
needsClick(target: any /* EventTarget | Element */): boolean;
|
||||
needsFocus(target: any /* EventTarget | Element */): boolean;
|
||||
}
|
||||
|
||||
interface FastClickOptions {
|
||||
touchBoundary?: number;
|
||||
tapDelay?: number;
|
||||
}
|
||||
|
||||
interface FastClickStatic {
|
||||
new(layer: any, options?: FastClickOptions): FastClickObject;
|
||||
attach(layer: any, options?: FastClickOptions): FastClickObject;
|
||||
}
|
||||
|
||||
declare module "fastclick" {
|
||||
function fastclick(layer: any, options?: FastClickOptions): FastClickObject;
|
||||
module fastclick {
|
||||
var FastClick: FastClickStatic;
|
||||
}
|
||||
|
||||
export = fastclick;
|
||||
}
|
||||
|
||||
declare var FastClick: FastClickStatic;
|
||||
Reference in New Issue
Block a user