# HG changeset patch # User cin # Date 2021-12-23 01:45:39 # Node ID d99e2014cea4f44cc1931f8caf944c05755822c0 # Parent 43e5b81813465237e0519d4614d09fde31798f06 minor code cleanups diff --git a/djx/build.gradle b/djx/build.gradle --- a/djx/build.gradle +++ b/djx/build.gradle @@ -6,14 +6,14 @@ plugins { typescript { compilerOptions { lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"] - //listFiles = true + // listFiles = true declaration = true strict = true types = [] module = "amd" it.target = "es5" experimentalDecorators = true - noUnusedLocals = true + noUnusedLocals = false jsx = "react" jsxFactory = "createElement" moduleResolution = "node" diff --git a/djx/src/main/ts/tsx.ts b/djx/src/main/ts/tsx.ts --- a/djx/src/main/ts/tsx.ts +++ b/djx/src/main/ts/tsx.ts @@ -114,6 +114,6 @@ export const on = (... key: K, _descriptor: TypedPropertyDescriptor<(eventObj: EV) => void> | TypedPropertyDescriptor<() => void> ): any => { - const handlers = eventNames.map(eventName => ({ eventName, handlerMethod: key })) + const handlers = eventNames.map(eventName => ({ eventName, handlerMethod: key })); target._eventHandlers = target._eventHandlers ? target._eventHandlers.concat(handlers) : handlers; }; diff --git a/djx/src/main/ts/tsx/HtmlRendition.ts b/djx/src/main/ts/tsx/HtmlRendition.ts --- a/djx/src/main/ts/tsx/HtmlRendition.ts +++ b/djx/src/main/ts/tsx/HtmlRendition.ts @@ -23,8 +23,7 @@ export class HtmlRendition extends Rendi _create(attrs: object, children: any[]) { this._element = dom.create(this.elementType, attrs); - if (children) - children.forEach(v => this._addChild(v)); + children.forEach(v => this._addChild(v)); } _getDomNode() { diff --git a/djx/src/main/ts/tsx/RenditionBase.ts b/djx/src/main/ts/tsx/RenditionBase.ts --- a/djx/src/main/ts/tsx/RenditionBase.ts +++ b/djx/src/main/ts/tsx/RenditionBase.ts @@ -29,6 +29,7 @@ export abstract class RenditionBase x.startup()); + if (isElementNode(target)) { + const w = registry.byNode(target); + if (w) { + if (w.startup) + w.startup(); + } else { + registry.findWidgets(target, skipNode).forEach(x => x.startup()); + } } } else { if (target.startup) diff --git a/djx/src/test/ts/view/MyWidget.tsx b/djx/src/test/ts/view/MyWidget.tsx --- a/djx/src/test/ts/view/MyWidget.tsx +++ b/djx/src/test/ts/view/MyWidget.tsx @@ -60,7 +60,7 @@ export class MyWidget extends djbase(Djx } @on("count-inc") - _onCounterInc(evt: Event & { detail: number; x?: number; }) { + private _onCounterInc(evt: Event & { detail: number; x?: number; }) { } @on("click", "keydown") diff --git a/djx/src/test/tsconfig.json b/djx/src/test/tsconfig.json --- a/djx/src/test/tsconfig.json +++ b/djx/src/test/tsconfig.json @@ -1,6 +1,7 @@ { "extends": "../tsconfig", "compilerOptions": { + "noUnusedLocals": false, //"rootDir": "ts", "rootDirs": [ "ts",