refactor(all): avoid using export const enum (#16614)

* refactor(all): avoid using export const enum

fixes #16497

* add tslint
This commit is contained in:
Manu MA
2018-12-06 21:19:49 +01:00
committed by GitHub
parent 95c0b1bac7
commit 119e0c1fd2
24 changed files with 149 additions and 165 deletions

View File

@ -2,15 +2,13 @@ import { ComponentProps, FrameworkDelegate } from '../../interface';
import { attachComponent } from '../../utils/framework-delegate';
import { assert } from '../../utils/helpers';
export const enum ViewState {
New = 1,
Attached,
Destroyed
}
export const VIEW_STATE_NEW = 1;
export const VIEW_STATE_ATTACHED = 2;
export const VIEW_STATE_DESTROYED = 3;
export class ViewController {
state: ViewState = ViewState.New;
state = VIEW_STATE_NEW;
nav?: any;
element?: HTMLElement;
delegate?: FrameworkDelegate;
@ -21,7 +19,7 @@ export class ViewController {
) {}
async init(container: HTMLElement) {
this.state = ViewState.Attached;
this.state = VIEW_STATE_ATTACHED;
if (!this.element) {
const component = this.component;
@ -33,7 +31,7 @@ export class ViewController {
* DOM WRITE
*/
_destroy() {
assert(this.state !== ViewState.Destroyed, 'view state must be ATTACHED');
assert(this.state !== VIEW_STATE_DESTROYED, 'view state must be ATTACHED');
const element = this.element;
if (element) {
@ -44,7 +42,7 @@ export class ViewController {
}
}
this.nav = undefined;
this.state = ViewState.Destroyed;
this.state = VIEW_STATE_DESTROYED;
}
}