mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 05:58:26 +08:00
refactor(platform): move to constants from enum, fix type definition
move to constants from enum, fix type definition
This commit is contained in:
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user