mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
chore(): fix typescript errors
This commit is contained in:
@ -14,12 +14,12 @@ import {Injectable} from 'angular2/core';
|
|||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class Form {
|
export class Form {
|
||||||
|
private _blur: HTMLElement;
|
||||||
|
private _focused: any = null;
|
||||||
|
private _ids: number = -1;
|
||||||
|
private _inputs: Array<any> = [];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this._inputs = [];
|
|
||||||
this._ids = -1;
|
|
||||||
this._focused = null;
|
|
||||||
|
|
||||||
this.focusCtrl(document);
|
this.focusCtrl(document);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,10 @@ export class Form {
|
|||||||
|
|
||||||
focusOut() {
|
focusOut() {
|
||||||
console.debug('focusOut');
|
console.debug('focusOut');
|
||||||
document.activeElement && document.activeElement.blur();
|
let activeElement: any = document.activeElement;
|
||||||
|
if (activeElement) {
|
||||||
|
activeElement.blur();
|
||||||
|
}
|
||||||
this._blur.focus();
|
this._blur.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,11 +23,8 @@ import {hasFocusedTextInput, raf, rafFrames} from './dom';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class Keyboard {
|
export class Keyboard {
|
||||||
|
|
||||||
constructor(config: Config, form: Form, zone: NgZone) {
|
constructor(config: Config, private _form: Form, private _zone: NgZone) {
|
||||||
this.form = form;
|
_zone.runOutsideAngular(() => {
|
||||||
this.zone = zone;
|
|
||||||
|
|
||||||
zone.runOutsideAngular(() => {
|
|
||||||
this.focusOutline(config.get('focusOutline'), document);
|
this.focusOutline(config.get('focusOutline'), document);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -85,13 +82,13 @@ export class Keyboard {
|
|||||||
promise = new Promise(resolve => { callback = resolve; });
|
promise = new Promise(resolve => { callback = resolve; });
|
||||||
}
|
}
|
||||||
|
|
||||||
self.zone.runOutsideAngular(() => {
|
self._zone.runOutsideAngular(() => {
|
||||||
|
|
||||||
function checkKeyboard() {
|
function checkKeyboard() {
|
||||||
console.debug('keyboard isOpen', self.isOpen(), checks);
|
console.debug('keyboard isOpen', self.isOpen(), checks);
|
||||||
if (!self.isOpen() || checks > 100) {
|
if (!self.isOpen() || checks > 100) {
|
||||||
rafFrames(30, () => {
|
rafFrames(30, () => {
|
||||||
self.zone.run(() => {
|
self._zone.run(() => {
|
||||||
console.debug('keyboard closed');
|
console.debug('keyboard closed');
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
@ -118,7 +115,7 @@ export class Keyboard {
|
|||||||
raf(() => {
|
raf(() => {
|
||||||
if (hasFocusedTextInput()) {
|
if (hasFocusedTextInput()) {
|
||||||
// only focus out when a text input has focus
|
// only focus out when a text input has focus
|
||||||
this.form.focusOut();
|
this._form.focusOut();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -172,7 +169,7 @@ export class Keyboard {
|
|||||||
function enableKeyInput() {
|
function enableKeyInput() {
|
||||||
cssClass();
|
cssClass();
|
||||||
|
|
||||||
self.zone.runOutsideAngular(() => {
|
self._zone.runOutsideAngular(() => {
|
||||||
document.removeEventListener('mousedown', pointerDown);
|
document.removeEventListener('mousedown', pointerDown);
|
||||||
document.removeEventListener('touchstart', pointerDown);
|
document.removeEventListener('touchstart', pointerDown);
|
||||||
|
|
||||||
|
@ -51,14 +51,14 @@ function _baseExtend(dst, objs, deep) {
|
|||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function debounce(func, wait, immediate) {
|
export function debounce(func: any, wait: number, immediate: boolean) {
|
||||||
var timeout, args, context, timestamp, result;
|
var timeout, args, context, timestamp: number, result;
|
||||||
return function() {
|
return function() {
|
||||||
context = this;
|
context = this;
|
||||||
args = arguments;
|
args = arguments;
|
||||||
timestamp = new Date();
|
timestamp = Date.now();
|
||||||
var later = function() {
|
var later: any = function() {
|
||||||
var last = (new Date()) - timestamp;
|
var last: any = Date.now() - timestamp;
|
||||||
if (last < wait) {
|
if (last < wait) {
|
||||||
timeout = setTimeout(later, wait - last);
|
timeout = setTimeout(later, wait - last);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user