Merge pull request #26243 from AndersonFriaca/jquery-mouse-exit

Types for JQuery Mouse Exit
This commit is contained in:
Armando Aguirre
2018-06-04 16:43:17 -07:00
committed by GitHub
4 changed files with 58 additions and 0 deletions

23
types/jquery-mouse-exit/index.d.ts vendored Normal file
View File

@@ -0,0 +1,23 @@
// Type definitions for jquery-mouse-exit 1.0
// Project: https://github.com/makeup-jquery/jquery-mouse-exit
// Definitions by: Anderson Friaça <https://github.com/AndersonFriaca>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery" />
export type Options = Partial<{
delay: number;
}>;
export type FocusElements = Partial<{
lostFocus: HTMLElement;
gainedFocus: HTMLElement;
}>;
declare global {
interface JQuery {
mouseExit(options?: Options): JQuery;
on(event: 'mouseExit', handler: ((event: JQuery.Event<HTMLElement>, data: FocusElements) => void)): JQuery;
}
}

View File

@@ -0,0 +1,9 @@
// init plugin
$('#container').mouseExit({
delay: 500
});
// handle event
$('#container').on('mouseExit', (e, data) => {
console.log(data.lostFocus, data.gainedFocus);
});

View File

@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
},
"files": [
"index.d.ts",
"jquery-mouse-exit-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{"extends": "dtslint/dt.json"}