chore(): fix typescript errors

This commit is contained in:
Adam Bradley
2016-01-10 00:32:36 -06:00
parent 84f8e619b8
commit 3a88b9ff91
3 changed files with 19 additions and 19 deletions

View File

@ -14,12 +14,12 @@ import {Injectable} from 'angular2/core';
*/
@Injectable()
export class Form {
private _blur: HTMLElement;
private _focused: any = null;
private _ids: number = -1;
private _inputs: Array<any> = [];
constructor() {
this._inputs = [];
this._ids = -1;
this._focused = null;
this.focusCtrl(document);
}
@ -51,7 +51,10 @@ export class Form {
focusOut() {
console.debug('focusOut');
document.activeElement && document.activeElement.blur();
let activeElement: any = document.activeElement;
if (activeElement) {
activeElement.blur();
}
this._blur.focus();
}

View File

@ -23,11 +23,8 @@ import {hasFocusedTextInput, raf, rafFrames} from './dom';
@Injectable()
export class Keyboard {
constructor(config: Config, form: Form, zone: NgZone) {
this.form = form;
this.zone = zone;
zone.runOutsideAngular(() => {
constructor(config: Config, private _form: Form, private _zone: NgZone) {
_zone.runOutsideAngular(() => {
this.focusOutline(config.get('focusOutline'), document);
});
}
@ -85,13 +82,13 @@ export class Keyboard {
promise = new Promise(resolve => { callback = resolve; });
}
self.zone.runOutsideAngular(() => {
self._zone.runOutsideAngular(() => {
function checkKeyboard() {
console.debug('keyboard isOpen', self.isOpen(), checks);
if (!self.isOpen() || checks > 100) {
rafFrames(30, () => {
self.zone.run(() => {
self._zone.run(() => {
console.debug('keyboard closed');
callback();
});
@ -118,7 +115,7 @@ export class Keyboard {
raf(() => {
if (hasFocusedTextInput()) {
// only focus out when a text input has focus
this.form.focusOut();
this._form.focusOut();
}
});
}
@ -172,7 +169,7 @@ export class Keyboard {
function enableKeyInput() {
cssClass();
self.zone.runOutsideAngular(() => {
self._zone.runOutsideAngular(() => {
document.removeEventListener('mousedown', pointerDown);
document.removeEventListener('touchstart', pointerDown);

View File

@ -51,14 +51,14 @@ function _baseExtend(dst, objs, deep) {
return dst;
}
export function debounce(func, wait, immediate) {
var timeout, args, context, timestamp, result;
export function debounce(func: any, wait: number, immediate: boolean) {
var timeout, args, context, timestamp: number, result;
return function() {
context = this;
args = arguments;
timestamp = new Date();
var later = function() {
var last = (new Date()) - timestamp;
timestamp = Date.now();
var later: any = function() {
var last: any = Date.now() - timestamp;
if (last < wait) {
timeout = setTimeout(later, wait - last);
} else {