feat:Add callId for debugging call

This commit is contained in:
pengfei.zhou 2021-03-04 13:31:39 +08:00 committed by osborn
parent e78625281f
commit aa56fd93d9
3 changed files with 15 additions and 9 deletions

View File

@ -4306,7 +4306,8 @@ function initNativeEnvironment(source) {
});
break;
case "invokeMethod":
console.log("invokeMethod", payload);
const callId = payload.callId;
console.log("invokeMethod", callId, payload);
const values = payload.values;
let args = [];
for (let i = 0; i < values.length; i++) {
@ -4333,12 +4334,13 @@ function initNativeEnvironment(source) {
const object = Reflect.get(global$1, payload.objectName);
const method = Reflect.get(object, payload.functionName);
const result = Reflect.apply(method, undefined, args);
console.log(result);
console.log("Result", callId, result);
ws.send(JSON.stringify({
type: "D2C",
cmd: 'invokeMethod',
payload: {
result
result,
callId,
}
}));
break;

View File

@ -92,7 +92,8 @@ async function initNativeEnvironment(source: string) {
})
break
case "invokeMethod":
console.log("invokeMethod", payload)
const callId = payload.callId;
console.log("invokeMethod", callId, payload)
const values = payload.values as { type: number, value: string }[]
let args = []
for (let i = 0; i < values.length; i++) {
@ -114,12 +115,13 @@ async function initNativeEnvironment(source: string) {
const object = Reflect.get(global, payload.objectName as string)
const method = Reflect.get(object, payload.functionName as string)
const result = Reflect.apply(method, undefined, args)
console.log(result)
console.log("Result", callId, result)
ws.send(JSON.stringify({
type: "D2C",
cmd: 'invokeMethod',
payload: {
result
result,
callId,
}
} as MSG))
break;

View File

@ -98,7 +98,8 @@ function initNativeEnvironment(source) {
});
break;
case "invokeMethod":
console.log("invokeMethod", payload);
const callId = payload.callId;
console.log("invokeMethod", callId, payload);
const values = payload.values;
let args = [];
for (let i = 0; i < values.length; i++) {
@ -125,12 +126,13 @@ function initNativeEnvironment(source) {
const object = Reflect.get(global, payload.objectName);
const method = Reflect.get(object, payload.functionName);
const result = Reflect.apply(method, undefined, args);
console.log(result);
console.log("Result", callId, result);
ws.send(JSON.stringify({
type: "D2C",
cmd: 'invokeMethod',
payload: {
result
result,
callId,
}
}));
break;