refactor(platform): move to constants from enum, fix type definition

move to constants from enum, fix type definition
This commit is contained in:
Dan Bucholtz
2017-03-02 15:07:34 -06:00
parent 72c2b623e5
commit 15eaad6044
3 changed files with 11 additions and 14 deletions

View File

@ -1,12 +1,9 @@
export enum Key {
LEFT = 37,
UP = 38,
RIGHT = 39,
DOWN = 40,
ENTER = 13,
ESCAPE = 27,
SPACE = 32,
TAB = 9
}
export const KEY_LEFT = 37;
export const KEY_UP = 38;
export const KEY_RIGHT = 39;
export const KEY_DOWN = 40;
export const KEY_ENTER = 13;
export const KEY_ESCAPE = 27;
export const KEY_SPACE = 32;
export const KEY_TAB = 9;

View File

@ -3,7 +3,7 @@ import { Injectable, NgZone } from '@angular/core';
import { Config } from '../config/config';
import { DomController } from './dom-controller';
import { isTextInput } from '../util/dom';
import { Key } from './key';
import { KEY_TAB } from './key';
import { Platform } from './platform';
@ -176,7 +176,7 @@ export class Keyboard {
// default is to add the focus-outline when the tab key is used
function keyDown(ev: KeyboardEvent) {
if (!isKeyInputEnabled && ev.keyCode === Key.TAB) {
if (!isKeyInputEnabled && ev.keyCode === KEY_TAB) {
isKeyInputEnabled = true;
enableKeyInput();
}

View File

@ -796,7 +796,7 @@ export class Platform {
// add the window resize event listener XXms after
this.timeout(() => {
var timerId: number;
var timerId: any;
this.registerListener(this._win, 'resize', () => {
clearTimeout(timerId);