diff --git a/Android/app/src/main/java/com/github/pengfeizhou/hegodemo/MainActivity.java b/Android/app/src/main/java/com/github/pengfeizhou/hegodemo/MainActivity.java index e7b258c6..a762b2e0 100644 --- a/Android/app/src/main/java/com/github/pengfeizhou/hegodemo/MainActivity.java +++ b/Android/app/src/main/java/com/github/pengfeizhou/hegodemo/MainActivity.java @@ -13,6 +13,6 @@ public class MainActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); HegoContext hegoContext = HegoContext.createContext(HegoUtils.readAssetFile("demo.js"), "demo"); - hegoContext.callJS(""); + hegoContext.callJS("log"); } } diff --git a/Android/hego/src/main/java/com/github/pengfeizhou/hego/HegoJSEngine.java b/Android/hego/src/main/java/com/github/pengfeizhou/hego/HegoJSEngine.java index 85186566..39953f29 100644 --- a/Android/hego/src/main/java/com/github/pengfeizhou/hego/HegoJSEngine.java +++ b/Android/hego/src/main/java/com/github/pengfeizhou/hego/HegoJSEngine.java @@ -155,7 +155,7 @@ public class HegoJSEngine implements Handler.Callback { if (args.length > 0) { System.arraycopy(args, 0, nArgs, 2, args.length); } - return invokeHegoMethod(HegoConstant.HEGO_CONTEXT_INVOKE, args); + return invokeHegoMethod(HegoConstant.HEGO_CONTEXT_INVOKE, nArgs); } diff --git a/js-framework/demo.ts b/js-framework/demo.ts index 58556c3b..4ac88bd3 100644 --- a/js-framework/demo.ts +++ b/js-framework/demo.ts @@ -16,7 +16,7 @@ layout.space = 10 console.log(layout.viewId) console.log(layout.toModel()) -@Registor +@Registor(context) export class MyPage extends Panel { build() { return layout diff --git a/js-framework/index.ts b/js-framework/index.ts index 452fefde..b75927fd 100644 --- a/js-framework/index.ts +++ b/js-framework/index.ts @@ -1,4 +1,5 @@ export * from "./src/ui/view" export * from "./src/ui/panel" export * from "./src/util/color" -export * from './src/util/log' \ No newline at end of file +export * from './src/util/log' +export * from './src/runtime/global' \ No newline at end of file diff --git a/js-framework/src/ui/panel.ts b/js-framework/src/ui/panel.ts index db5caca8..b9b73840 100644 --- a/js-framework/src/ui/panel.ts +++ b/js-framework/src/ui/panel.ts @@ -1,12 +1,13 @@ import { View } from "./view"; -import { } from '../runtime/global' -export function Registor(constructor: T) { - const ret = class extends constructor { - context = context +export function Registor(context: any) { + return (constructor: T) => { + const ret = class extends constructor { + context = context + } + context.register(new ret) + return ret } - context.register(new ret) - return ret }