##// END OF EJS Templates
minor code cleanups
cin -
r93:d99e2014cea4 default
parent child
Show More
@@ -13,7 +13,7 typescript {
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,7 +23,6 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 26 children.forEach(v => this._addChild(v));
28 27 }
29 28
@@ -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,7 +107,8 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;
110 if (isElementNode(target)) {
111 const w = registry.byNode(target);
111 112 if (w) {
112 113 w.destroyRecursive();
113 114 } else {
@@ -116,6 +117,7 export function destroy(target: Node | I
116 117 }
117 118 }
118 119 }
120 }
119 121
120 122 /** Empties a content of the specified node and destroys all contained widgets.
121 123 *
@@ -134,13 +136,15 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;
139 if (isElementNode(target)) {
140 const w = registry.byNode(target);
138 141 if (w) {
139 142 if (w.startup)
140 143 w.startup();
141 144 } else {
142 145 registry.findWidgets(target, skipNode).forEach(x => x.startup());
143 146 }
147 }
144 148 } else {
145 149 if (target.startup)
146 150 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