Added types for wheel

This commit is contained in:
Bradley Odell
2017-11-27 01:15:37 -08:00
parent 3289762cca
commit b4e2d2c3da
4 changed files with 58 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
// Type definitions for wheel 0.0.5
// Project: https://github.com/anvaka/wheel
// Definitions by: Bradley Odell <https://github.com/BTOdell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Adds a callback to receive mouse wheel events from the given element.
*/
export default function addWheelListener(element: GlobalEventHandlers,
callback: (event: WheelEvent) => void,
useCapture?: boolean): void;
/**
* Adds a callback to receive mouse wheel events from the given element.
*/
export function addWheelListener(element: GlobalEventHandlers,
callback: (event: WheelEvent) => void,
useCapture?: boolean): void;
/**
* Removes a previously added wheel listener callback.
*/
export function removeWheelListener(element: GlobalEventHandlers,
callback: (event: WheelEvent) => void,
useCapture?: boolean): void;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es5", "dom"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"wheel-tests.ts"
]
}
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
"dt-header": false
}
}
+8
View File
@@ -0,0 +1,8 @@
import {addWheelListener, removeWheelListener} from "wheel";
const wheelListener = (event: WheelEvent) => {
event.preventDefault();
removeWheelListener(document, wheelListener);
};
addWheelListener(document, wheelListener);