Remove nativeEmpty, check call change to native side

This commit is contained in:
pengfei.zhou
2021-09-16 11:53:32 +08:00
committed by osborn
parent 3d3f646845
commit dd4e8db3ad
20 changed files with 72 additions and 93 deletions

View File

@@ -1233,11 +1233,6 @@ function hookBeforeNativeCall(context) {
context.hookBeforeNativeCall();
}
}
function hookAfterNativeCall(context) {
if (context) {
context.hookAfterNativeCall();
}
}
function getContext() {
return Reflect.getMetadata('__doric_context__', global$2);
}
@@ -1261,7 +1256,6 @@ function jsCallResolve(contextId, callbackId, args) {
}
hookBeforeNativeCall(context);
Reflect.apply(callback.resolve, context, argumentsList);
hookAfterNativeCall(context);
}
function jsCallReject(contextId, callbackId, args) {
const context = gContexts.get(contextId);
@@ -1280,7 +1274,6 @@ function jsCallReject(contextId, callbackId, args) {
}
hookBeforeNativeCall(context);
Reflect.apply(callback.reject, context.entity, argumentsList);
hookAfterNativeCall(context);
}
class Context {
constructor(id) {
@@ -1419,7 +1412,6 @@ function jsCallEntityMethod(contextId, methodName, args) {
}
hookBeforeNativeCall(context);
const ret = Reflect.apply(Reflect.get(context.entity, methodName), context.entity, argumentsList);
hookAfterNativeCall(context);
return ret;
}
else {
@@ -1574,11 +1566,15 @@ function jsCallbackTimer(timerId) {
return;
}
if (timerInfo.callback instanceof Function) {
setContext(timerInfo.context);
hookBeforeNativeCall(timerInfo.context);
Reflect.apply(timerInfo.callback, timerInfo.context, []);
hookAfterNativeCall(timerInfo.context);
}
}
function jsHookAfterNativeCall() {
const context = getContext();
context === null || context === void 0 ? void 0 : context.hookAfterNativeCall();
}
var doric = /*#__PURE__*/Object.freeze({
__proto__: null,
@@ -1593,7 +1589,8 @@ var doric = /*#__PURE__*/Object.freeze({
jsCallEntityMethod: jsCallEntityMethod,
pureCallEntityMethod: pureCallEntityMethod,
jsObtainEntry: jsObtainEntry,
jsCallbackTimer: jsCallbackTimer
jsCallbackTimer: jsCallbackTimer,
jsHookAfterNativeCall: jsHookAfterNativeCall
});
function obj2Model(obj, convertor) {
@@ -2520,7 +2517,7 @@ 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));