refactor(ProtoViewDto): switch to enum

This commit is contained in:
Victor Berchet
2015-06-09 15:20:33 +02:00
parent af35ab56a3
commit 6ca81fb98c
12 changed files with 38 additions and 38 deletions
+12 -11
View File
@@ -92,28 +92,29 @@ export class DirectiveBinder {
}
}
export class ProtoViewDto {
// A view that contains the host element with bound
// component directive.
// Contains a view of type #COMPONENT_VIEW_TYPE.
static get HOST_VIEW_TYPE() { return 0; }
export enum ViewType {
// A view that contains the host element with bound component directive.
// Contains a COMPONENT view
HOST,
// The view of the component
// Can contain 0 to n views of type #EMBEDDED_VIEW_TYPE
static get COMPONENT_VIEW_TYPE() { return 1; }
// Can contain 0 to n EMBEDDED views
COMPONENT,
// A view that is embedded into another View via a <template> element
// inside of a component view
static get EMBEDDED_VIEW_TYPE() { return 2; }
// inside of a COMPONENT view
EMBEDDED
}
export class ProtoViewDto {
render: RenderProtoViewRef;
elementBinders: List<ElementBinder>;
variableBindings: Map<string, string>;
type: number;
type: ViewType;
constructor({render, elementBinders, variableBindings, type}: {
render?: RenderProtoViewRef,
elementBinders?: List<ElementBinder>,
variableBindings?: Map<string, string>,
type?: number
type?: ViewType
}) {
this.render = render;
this.elementBinders = elementBinders;