##// END OF EJS Templates
minor code cleanups
cin -
r93:d99e2014cea4 default
parent child
Show More
@@ -6,14 +6,14 plugins {
6 6 typescript {
7 7 compilerOptions {
8 8 lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"]
9 //listFiles = true
9 // listFiles = true
10 10 declaration = true
11 11 strict = true
12 12 types = []
13 13 module = "amd"
14 14 it.target = "es5"
15 15 experimentalDecorators = true
16 noUnusedLocals = true
16 noUnusedLocals = false
17 17 jsx = "react"
18 18 jsxFactory = "createElement"
19 19 moduleResolution = "node"
@@ -114,6 +114,6 export const on = <E extends string>(...
114 114 key: K,
115 115 _descriptor: TypedPropertyDescriptor<(eventObj: EV) => void> | TypedPropertyDescriptor<() => void>
116 116 ): any => {
117 const handlers = eventNames.map(eventName => ({ eventName, handlerMethod: key }))
117 const handlers = eventNames.map(eventName => ({ eventName, handlerMethod: key }));
118 118 target._eventHandlers = target._eventHandlers ? target._eventHandlers.concat(handlers) : handlers;
119 119 };
@@ -23,8 +23,7 export class HtmlRendition extends Rendi
23 23 _create(attrs: object, children: any[]) {
24 24 this._element = dom.create(this.elementType, attrs);
25 25
26 if (children)
27 children.forEach(v => this._addChild(v));
26 children.forEach(v => this._addChild(v));
28 27 }
29 28
30 29 _getDomNode() {
@@ -29,6 +29,7 export abstract class RenditionBase<TNod
29 29 }
30 30 }
31 31
32 /** Renders DOM element for different types of the argument. */
32 33 protected getItemDom(v: any) {
33 34 const tv = typeof v;
34 35
@@ -39,7 +40,7 export abstract class RenditionBase<TNod
39 40 // nodes are kept as is
40 41 return v;
41 42 } else if (isRendition(v)) {
42 // renditions as instantinated
43 // renditions are instantiated
43 44 return v.getDomNode();
44 45 } else if (isWidget(v)) {
45 46 // widgets are converted to it's markup
@@ -62,9 +63,9 export abstract class RenditionBase<TNod
62 63 }
63 64 }
64 65
65 /** @deprecated will be removed in 1.0.0, use getDomNode() */
66 getDomElement() {
67 return this.getDomNode();
66 /** Is rendition was instantiated to the DOM node */
67 isCreated() {
68 return this._created;
68 69 }
69 70
70 71 /** Creates DOM node if not created. No additional actions are taken. */
@@ -107,12 +107,14 export function destroy(target: Node | I
107 107 } else if (isDestroyable(target)) {
108 108 target.destroy();
109 109 } else if (isNode(target)) {
110 const w = isElementNode(target) ? registry.byNode(target) : undefined;
111 if (w) {
112 w.destroyRecursive();
113 } else {
114 registry.findWidgets(target).forEach(destroy);
115 dom.destroy(target);
110 if (isElementNode(target)) {
111 const w = registry.byNode(target);
112 if (w) {
113 w.destroyRecursive();
114 } else {
115 registry.findWidgets(target).forEach(destroy);
116 dom.destroy(target);
117 }
116 118 }
117 119 }
118 120 }
@@ -134,12 +136,14 export function emptyNode(target: Node)
134 136 */
135 137 export function startupWidgets(target: Node | _WidgetBase, skipNode?: Node) {
136 138 if (isNode(target)) {
137 const w = isElementNode(target) ? registry.byNode(target) : undefined;
138 if (w) {
139 if (w.startup)
140 w.startup();
141 } else {
142 registry.findWidgets(target, skipNode).forEach(x => x.startup());
139 if (isElementNode(target)) {
140 const w = registry.byNode(target);
141 if (w) {
142 if (w.startup)
143 w.startup();
144 } else {
145 registry.findWidgets(target, skipNode).forEach(x => x.startup());
146 }
143 147 }
144 148 } else {
145 149 if (target.startup)
@@ -60,7 +60,7 export class MyWidget extends djbase(Djx
60 60 }
61 61
62 62 @on("count-inc")
63 _onCounterInc(evt: Event & { detail: number; x?: number; }) {
63 private _onCounterInc(evt: Event & { detail: number; x?: number; }) {
64 64 }
65 65
66 66 @on("click", "keydown")
@@ -1,6 +1,7
1 1 {
2 2 "extends": "../tsconfig",
3 3 "compilerOptions": {
4 "noUnusedLocals": false,
4 5 //"rootDir": "ts",
5 6 "rootDirs": [
6 7 "ts",
General Comments 0
You need to be logged in to leave comments. Login now