diff --git a/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts b/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts index 8a707f057d..fa5cf72a30 100644 --- a/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts +++ b/types/cordova-plugin-keyboard/cordova-plugin-keyboard-tests.ts @@ -28,4 +28,4 @@ window.addEventListener('keyboardWillShow', () => console.log('keyboardWillShow' window.addEventListener('keyboardWillHide', () => console.log('keyboardWillHide')); -window.addEventListener('keyboardHeightWillChange', (event) => console.log(`keyboardHeightWillChange - keyboard height: ${event.keyboardHeight}`)); +window.addEventListener('keyboardHeightWillChange', (event: CordovaKeyboardEvent) => console.log(`keyboardHeightWillChange - keyboard height: ${event.keyboardHeight}`)); diff --git a/types/cordova-plugin-keyboard/index.d.ts b/types/cordova-plugin-keyboard/index.d.ts index 6298050b2c..af880d732a 100644 --- a/types/cordova-plugin-keyboard/index.d.ts +++ b/types/cordova-plugin-keyboard/index.d.ts @@ -136,7 +136,18 @@ interface Keyboard { * * */ - automaticScrollToTopOnHiding: boolean + automaticScrollToTopOnHiding: boolean, + + /** + * Deprecated Events + */ + onshow(): void, + + onhide(): void, + + onhiding(): void, + + onshowing(): void } interface CordovaKeyboardEvent extends Event { @@ -144,42 +155,31 @@ interface CordovaKeyboardEvent extends Event { keyboardHeight: number; } -interface Window { +interface WindowEventMap { /** - * @param type This event is fired when keyboard fully shown. - * - * @param callback Function is called when keyboard is shown. + * This event is fired when keyboard fully shown. */ - addEventListener(type: 'keyboardDidShow', callback: () => any, useCapture?: boolean): void; + 'keyboardDidShow': Event, /** - * @param type This event is fired when the keyboard is fully closed. - * - * @param callback Function is called when keyboard is closed. + * This event is fired when the keyboard is fully closed. */ - addEventListener(type: 'keyboardDidHide', callback: () => any, useCapture?: boolean): void; + 'keyboardDidHide': Event, /** - * @param type This event fires before keyboard will be shown. - * - * @param callback Function is called when keyboard is about to be shown on the screen. + * This event fires before keyboard will be shown. */ - addEventListener(type: 'keyboardWillShow', callback: () => any, useCapture?: boolean): void; + 'keyboardWillShow': Event, /** - * @param type This event is fired when the keyboard is fully closed. - * - * @param callback Function is called when keyboard is about to be closed. + * This event is fired when the keyboard is fully closed. */ - addEventListener(type: 'keyboardWillHide', callback: () => any, useCapture?: boolean): void; + 'keyboardWillHide': Event, /** - * @param type This event is fired when the keyboard is fully closed. - * - * @param callback Function is called when keyboard is about to be closed. The function is - * passed an InAppBrowserEvent object as a parameter. + * This event is fired when the keyboard is fully closed. */ - addEventListener(type: 'keyboardHeightWillChange', callback: (event: CordovaKeyboardEvent) => any, useCapture?: boolean): void; -} + 'keyboardHeightWillChange': CordovaKeyboardEvent + } declare var Keyboard: Keyboard;