mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 03:31:47 +00:00
Added types for wheel
This commit is contained in:
Vendored
+25
@@ -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;
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"dt-header": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import {addWheelListener, removeWheelListener} from "wheel";
|
||||
|
||||
const wheelListener = (event: WheelEvent) => {
|
||||
event.preventDefault();
|
||||
removeWheelListener(document, wheelListener);
|
||||
};
|
||||
|
||||
addWheelListener(document, wheelListener);
|
||||
Reference in New Issue
Block a user