Remove nativeEmpty, check call change to native side
This commit is contained in:
@@ -59,12 +59,6 @@ function hookBeforeNativeCall(context?: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
function hookAfterNativeCall(context?: Context) {
|
||||
if (context) {
|
||||
context.hookAfterNativeCall()
|
||||
}
|
||||
}
|
||||
|
||||
function getContext(): Context | undefined {
|
||||
return Reflect.getMetadata('__doric_context__', global)
|
||||
}
|
||||
@@ -90,7 +84,6 @@ export function jsCallResolve(contextId: string, callbackId: string, args?: any)
|
||||
}
|
||||
hookBeforeNativeCall(context)
|
||||
Reflect.apply(callback.resolve, context, argumentsList)
|
||||
hookAfterNativeCall(context)
|
||||
}
|
||||
|
||||
export function jsCallReject(contextId: string, callbackId: string, args?: any) {
|
||||
@@ -110,7 +103,6 @@ export function jsCallReject(contextId: string, callbackId: string, args?: any)
|
||||
}
|
||||
hookBeforeNativeCall(context)
|
||||
Reflect.apply(callback.reject, context.entity, argumentsList)
|
||||
hookAfterNativeCall(context)
|
||||
}
|
||||
|
||||
export class Context {
|
||||
@@ -231,7 +223,6 @@ export function jsCallEntityMethod(contextId: string, methodName: string, args?:
|
||||
}
|
||||
hookBeforeNativeCall(context)
|
||||
const ret = Reflect.apply(Reflect.get(context.entity, methodName), context.entity, argumentsList)
|
||||
hookAfterNativeCall(context)
|
||||
return ret
|
||||
} else {
|
||||
loge(`Cannot find method for context id:${contextId},method name is:${methodName}`)
|
||||
@@ -392,8 +383,13 @@ export function jsCallbackTimer(timerId: number) {
|
||||
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?.hookAfterNativeCall()
|
||||
}
|
||||
|
@@ -70,12 +70,6 @@ function hookBeforeNativeCall(context?: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
function hookAfterNativeCall(context?: Context) {
|
||||
if (context) {
|
||||
context.hookAfterNativeCall()
|
||||
}
|
||||
}
|
||||
|
||||
function getContext(): Context | undefined {
|
||||
return Reflect.getMetadata('__doric_context__', global)
|
||||
}
|
||||
@@ -101,7 +95,6 @@ export function jsCallResolve(contextId: string, callbackId: string, args?: any)
|
||||
}
|
||||
hookBeforeNativeCall(context)
|
||||
Reflect.apply(callback.resolve, context, argumentsList)
|
||||
hookAfterNativeCall(context)
|
||||
}
|
||||
|
||||
export function jsCallReject(contextId: string, callbackId: string, args?: any) {
|
||||
@@ -121,7 +114,6 @@ export function jsCallReject(contextId: string, callbackId: string, args?: any)
|
||||
}
|
||||
hookBeforeNativeCall(context)
|
||||
Reflect.apply(callback.reject, context.entity, argumentsList)
|
||||
hookAfterNativeCall(context)
|
||||
}
|
||||
|
||||
export class Context {
|
||||
@@ -269,7 +261,6 @@ export function jsCallEntityMethod(contextId: string, methodName: string, args?:
|
||||
}
|
||||
hookBeforeNativeCall(context)
|
||||
const ret = Reflect.apply(Reflect.get(context.entity, methodName), context.entity, argumentsList)
|
||||
hookAfterNativeCall(context)
|
||||
return ret
|
||||
} else {
|
||||
loge(`Cannot find method for context id:${contextId},method name is:${methodName}`)
|
||||
@@ -431,8 +422,13 @@ export function jsCallbackTimer(timerId: number) {
|
||||
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?.hookAfterNativeCall()
|
||||
}
|
||||
|
@@ -212,7 +212,7 @@ export abstract class Panel {
|
||||
const promises: Promise<any>[] = []
|
||||
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