Remove nativeEmpty, check call change to native side
This commit is contained in:
1
doric-js/lib/src/runtime/sandbox.d.ts
vendored
1
doric-js/lib/src/runtime/sandbox.d.ts
vendored
@@ -27,4 +27,5 @@ export declare function pureCallEntityMethod(contextId: string, methodName: stri
|
||||
declare type ClassType<T> = new (...args: any) => T;
|
||||
export declare function jsObtainEntry(contextId: string): () => ClassType<object> | ((constructor: ClassType<object>) => ClassType<object>);
|
||||
export declare function jsCallbackTimer(timerId: number): void;
|
||||
export declare function jsHookAfterNativeCall(): void;
|
||||
export {};
|
||||
|
@@ -22,11 +22,6 @@ function hookBeforeNativeCall(context) {
|
||||
context.hookBeforeNativeCall();
|
||||
}
|
||||
}
|
||||
function hookAfterNativeCall(context) {
|
||||
if (context) {
|
||||
context.hookAfterNativeCall();
|
||||
}
|
||||
}
|
||||
function getContext() {
|
||||
return Reflect.getMetadata('__doric_context__', global);
|
||||
}
|
||||
@@ -50,7 +45,6 @@ export function jsCallResolve(contextId, callbackId, args) {
|
||||
}
|
||||
hookBeforeNativeCall(context);
|
||||
Reflect.apply(callback.resolve, context, argumentsList);
|
||||
hookAfterNativeCall(context);
|
||||
}
|
||||
export function jsCallReject(contextId, callbackId, args) {
|
||||
const context = gContexts.get(contextId);
|
||||
@@ -69,7 +63,6 @@ export function jsCallReject(contextId, callbackId, args) {
|
||||
}
|
||||
hookBeforeNativeCall(context);
|
||||
Reflect.apply(callback.reject, context.entity, argumentsList);
|
||||
hookAfterNativeCall(context);
|
||||
}
|
||||
export class Context {
|
||||
constructor(id) {
|
||||
@@ -208,7 +201,6 @@ export function jsCallEntityMethod(contextId, methodName, args) {
|
||||
}
|
||||
hookBeforeNativeCall(context);
|
||||
const ret = Reflect.apply(Reflect.get(context.entity, methodName), context.entity, argumentsList);
|
||||
hookAfterNativeCall(context);
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
@@ -363,8 +355,12 @@ export function jsCallbackTimer(timerId) {
|
||||
return;
|
||||
}
|
||||
if (timerInfo.callback instanceof Function) {
|
||||
setContext(timerInfo.context);
|
||||
hookBeforeNativeCall(timerInfo.context);
|
||||
Reflect.apply(timerInfo.callback, timerInfo.context, []);
|
||||
hookAfterNativeCall(timerInfo.context);
|
||||
}
|
||||
}
|
||||
export function jsHookAfterNativeCall() {
|
||||
const context = getContext();
|
||||
context === null || context === void 0 ? void 0 : context.hookAfterNativeCall();
|
||||
}
|
||||
|
@@ -182,7 +182,7 @@ export class Panel {
|
||||
const promises = [];
|
||||
if (Environment.platform !== 'web') {
|
||||
//Here insert a native call to ensure the promise is resolved done.
|
||||
nativeEmpty();
|
||||
//nativeEmpty()
|
||||
if (this.__root__.isDirty()) {
|
||||
const model = this.__root__.toModel();
|
||||
promises.push(this.nativeRender(model));
|
||||
|
Reference in New Issue
Block a user