js:compat es5,use context.sendNative to replace Proxy
This commit is contained in:
@@ -157,7 +157,7 @@ export abstract class Panel {
|
||||
}
|
||||
|
||||
private nativeRender(model: Model) {
|
||||
(this.context as any).callNative("shader", "render", model)
|
||||
this.context.callNative("shader", "render", model)
|
||||
}
|
||||
|
||||
private hookBeforeNativeCall() {
|
||||
|
@@ -122,7 +122,6 @@ export abstract class View implements Modeling, IView {
|
||||
@Property
|
||||
hidden?: boolean
|
||||
|
||||
@Property
|
||||
viewId = uniqueId('ViewId')
|
||||
|
||||
@Property
|
||||
@@ -152,6 +151,9 @@ export abstract class View implements Modeling, IView {
|
||||
}
|
||||
|
||||
private id2Callback(id: string) {
|
||||
if (this.callbacks === undefined) {
|
||||
this.callbacks = new Map
|
||||
}
|
||||
let f = this.callbacks.get(id)
|
||||
if (f === undefined) {
|
||||
f = Reflect.get(this, id) as Function
|
||||
@@ -280,10 +282,9 @@ export abstract class View implements Modeling, IView {
|
||||
return this
|
||||
}
|
||||
|
||||
nativeChannel(context: any, name: string) {
|
||||
nativeChannel(context: BridgeContext, name: string) {
|
||||
let thisView: View | undefined = this
|
||||
return function (args: any = undefined) {
|
||||
const func = context.shader.command
|
||||
const viewIds = []
|
||||
while (thisView != undefined) {
|
||||
viewIds.push(thisView.viewId)
|
||||
@@ -294,7 +295,8 @@ export abstract class View implements Modeling, IView {
|
||||
name,
|
||||
args,
|
||||
}
|
||||
return Reflect.apply(func, undefined, [params]) as Promise<any>
|
||||
|
||||
return context.callNative('shader', 'command', params) as Promise<any>
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -109,7 +109,6 @@ export abstract class View implements Modeling, IView {
|
||||
@Property
|
||||
hidden?: boolean
|
||||
|
||||
@Property
|
||||
viewId = uniqueId('ViewId')
|
||||
|
||||
@Property
|
||||
@@ -278,10 +277,9 @@ export abstract class View implements Modeling, IView {
|
||||
return this
|
||||
}
|
||||
|
||||
nativeChannel(context: any, name: string) {
|
||||
nativeChannel(context: BridgeContext, name: string) {
|
||||
let thisView: View | undefined = this
|
||||
return function (args: any = undefined) {
|
||||
const func = context.shader.command
|
||||
const viewIds = []
|
||||
while (thisView != undefined) {
|
||||
viewIds.push(thisView.viewId)
|
||||
@@ -292,7 +290,8 @@ export abstract class View implements Modeling, IView {
|
||||
name,
|
||||
args,
|
||||
}
|
||||
return Reflect.apply(func, undefined, [params]) as Promise<any>
|
||||
|
||||
return context.callNative('shader', 'command', params) as Promise<any>
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user