keyboard.d.ts 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import { EventEmitter, NgZone } from '@angular/core';
  2. import { Config } from '../config/config';
  3. import { DomController } from './dom-controller';
  4. import { Platform } from './platform';
  5. /**
  6. * @name Keyboard
  7. * @description
  8. * The `Keyboard` class allows you to work with the keyboard events provided
  9. * by the Ionic keyboard plugin.
  10. *
  11. * @usage
  12. * ```ts
  13. * export class MyClass {
  14. *
  15. * constructor(public keyboard: Keyboard) { }
  16. *
  17. * }
  18. * ```
  19. */
  20. export declare class Keyboard {
  21. private _plt;
  22. private _zone;
  23. private _dom;
  24. _tmr: number;
  25. willShow: EventEmitter<number>;
  26. willHide: EventEmitter<void>;
  27. didShow: EventEmitter<number>;
  28. didHide: EventEmitter<void>;
  29. eventsAvailable: boolean;
  30. constructor(config: Config, _plt: Platform, _zone: NgZone, _dom: DomController);
  31. private listenV2(win);
  32. private listenV1(win);
  33. private blurActiveInput(shouldBlur);
  34. /**
  35. * Check to see if the keyboard is open or not.
  36. *
  37. * ```ts
  38. * export class MyClass {
  39. * constructor(public keyboard: Keyboard) {
  40. *
  41. * }
  42. *
  43. * keyboardCheck() {
  44. * console.log('The keyboard is open:', this.keyboard.isOpen());
  45. * }
  46. * }
  47. * ```
  48. *
  49. * @return {boolean} returns a true or false value if the keyboard is open or not.
  50. */
  51. isOpen(): boolean;
  52. /**
  53. * When the keyboard is closed, call any methods you want.
  54. *
  55. * ```ts
  56. * export class MyClass {
  57. * constructor(public keyboard: Keyboard) {
  58. * this.keyboard.onClose(this.closeCallback);
  59. * }
  60. * closeCallback() {
  61. * // call what ever functionality you want on keyboard close
  62. * console.log('Closing time');
  63. * }
  64. * }
  65. * ```
  66. *
  67. * @param {function} callback method you want to call when the keyboard has been closed.
  68. * @return {function} returns a callback that gets fired when the keyboard is closed.
  69. */
  70. onClose(callback: Function, pollingInternval?: number, pollingChecksMax?: number): Promise<any>;
  71. /**
  72. * Programmatically close the keyboard.
  73. */
  74. close(): void;
  75. /**
  76. * @hidden
  77. */
  78. focusOutline(setting: any): void;
  79. hasFocusedTextInput(): boolean;
  80. /**
  81. * Set to true to hide the additional toolbar that is on top of the keyboard.
  82. * This toolbar features the Prev, Next, and Done buttons.
  83. * @param hidden
  84. */
  85. hideFormAccessoryBar(hidden: boolean): void;
  86. }