diff --git a/Android/doric/src/main/java/pub/doric/engine/DoricJSEngine.java b/Android/doric/src/main/java/pub/doric/engine/DoricJSEngine.java index 7cc40445..a4bf460f 100644 --- a/Android/doric/src/main/java/pub/doric/engine/DoricJSEngine.java +++ b/Android/doric/src/main/java/pub/doric/engine/DoricJSEngine.java @@ -96,6 +96,12 @@ public class DoricJSEngine implements Handler.Callback, DoricTimerExtension.Time return null; } }); + mDoricJSE.injectGlobalJSFunction(DoricConstant.INJECT_EMPTY, new JavaFunction() { + @Override + public JavaValue exec(JSDecoder[] args) { + return null; + } + }); mDoricJSE.injectGlobalJSFunction(DoricConstant.INJECT_REQUIRE, new JavaFunction() { @Override public JavaValue exec(JSDecoder[] args) { diff --git a/Android/doric/src/main/java/pub/doric/utils/DoricConstant.java b/Android/doric/src/main/java/pub/doric/utils/DoricConstant.java index f4da7cdc..08a814b1 100644 --- a/Android/doric/src/main/java/pub/doric/utils/DoricConstant.java +++ b/Android/doric/src/main/java/pub/doric/utils/DoricConstant.java @@ -31,6 +31,7 @@ public class DoricConstant { public static final String INJECT_TIMER_SET = "nativeSetTimer"; public static final String INJECT_TIMER_CLEAR = "nativeClearTimer"; public static final String INJECT_BRIDGE = "nativeBridge"; + public static final String INJECT_EMPTY = "nativeEmpty"; public static final String TEMPLATE_CONTEXT_CREATE = "Reflect.apply(" + "function(doric,context,Entry,require,exports){" + "\n" + diff --git a/iOS/Pod/Classes/Engine/DoricJSEngine.m b/iOS/Pod/Classes/Engine/DoricJSEngine.m index 3559c0cb..12984ea8 100644 --- a/iOS/Pod/Classes/Engine/DoricJSEngine.m +++ b/iOS/Pod/Classes/Engine/DoricJSEngine.m @@ -59,7 +59,9 @@ - (void)initJSExecutor { [self.jsExecutor injectGlobalJSObject:INJECT_LOG obj:^(NSString *type, NSString *message) { DoricLog(@"JS:%@", message); }]; - + [self.jsExecutor injectGlobalJSObject:INJECT_EMPTY obj:^() { + + }]; [self.jsExecutor injectGlobalJSObject:INJECT_REQUIRE obj:^(NSString *name) { __strong typeof(_self) self = _self; if (!self) return NO; diff --git a/iOS/Pod/Classes/Util/DoricConstant.h b/iOS/Pod/Classes/Util/DoricConstant.h index 8256c9a9..06b34fd2 100644 --- a/iOS/Pod/Classes/Util/DoricConstant.h +++ b/iOS/Pod/Classes/Util/DoricConstant.h @@ -32,6 +32,7 @@ extern NSString *const INJECT_REQUIRE; extern NSString *const INJECT_TIMER_SET; extern NSString *const INJECT_TIMER_CLEAR; extern NSString *const INJECT_BRIDGE; +extern NSString *const INJECT_EMPTY; extern NSString *const TEMPLATE_CONTEXT_CREATE; diff --git a/iOS/Pod/Classes/Util/DoricConstant.m b/iOS/Pod/Classes/Util/DoricConstant.m index 6d936e1e..09a742a4 100644 --- a/iOS/Pod/Classes/Util/DoricConstant.m +++ b/iOS/Pod/Classes/Util/DoricConstant.m @@ -32,6 +32,7 @@ NSString *const INJECT_TIMER_SET = @"nativeSetTimer"; NSString *const INJECT_TIMER_CLEAR = @"nativeClearTimer"; NSString *const INJECT_BRIDGE = @"nativeBridge"; +NSString *const INJECT_EMPTY = @"nativeEmpty"; NSString *const TEMPLATE_CONTEXT_CREATE = @"Reflect.apply(" "function(doric,context,Entry,require,exports){" "\n" diff --git a/js-framework/src/ui/panel.ts b/js-framework/src/ui/panel.ts index a1473451..32115c37 100644 --- a/js-framework/src/ui/panel.ts +++ b/js-framework/src/ui/panel.ts @@ -31,6 +31,8 @@ export function NativeCall(target: Panel, propertyKey: string, descriptor: Prope type Frame = { width: number, height: number } +declare function nativeEmpty(): void + export abstract class Panel { context?: any onCreate() { } @@ -132,7 +134,7 @@ export abstract class Panel { private hookAfterNativeCall() { //Here insert a native call to ensure the promise is resolved done. - log('Check Dirty') + nativeEmpty() if (this.__root__.isDirty()) { const model = this.__root__.toModel() this.nativeRender(model)