mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-04-14 09:34:39 +00:00
Implement dom-inputevent
This commit is contained in:
10
types/dom-inputevent/dom-inputevent-tests.ts
Normal file
10
types/dom-inputevent/dom-inputevent-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
const input = document.createElement('input');
|
||||
input.addEventListener('input', (event: InputEvent) => {
|
||||
return event.data === 'foo' && event.isComposing === true;
|
||||
});
|
||||
|
||||
const foo = new InputEvent('input');
|
||||
const bar = new InputEvent('beforeinput', {
|
||||
data: 'bar',
|
||||
isComposing: true,
|
||||
});
|
||||
17
types/dom-inputevent/index.d.ts
vendored
Normal file
17
types/dom-inputevent/index.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Type definitions for UI Events W3C Working Draft — Input Events — Interface InputEvent 1.0
|
||||
// Project: https://w3c.github.io/uievents/#interface-inputevent
|
||||
// Definitions by: Steven Sinatra <https://github.com/diagramatics>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface InputEventInit extends UIEventInit {
|
||||
data?: string;
|
||||
isComposing: boolean;
|
||||
}
|
||||
interface InputEvent extends UIEvent {
|
||||
readonly data: string;
|
||||
readonly isComposing: boolean;
|
||||
}
|
||||
|
||||
declare class InputEvent {
|
||||
constructor(typeArg: 'input' | 'beforeinput', inputEventInit?: InputEventInit);
|
||||
}
|
||||
23
types/dom-inputevent/tsconfig.json
Normal file
23
types/dom-inputevent/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"dom-inputevent-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/dom-inputevent/tslint.json
Normal file
1
types/dom-inputevent/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user