From aa56fd93d99e4b2d6ee2a95fb5fdbb97472932eb Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Thu, 4 Mar 2021 13:31:39 +0800 Subject: [PATCH] feat:Add callId for debugging call --- doric-js/bundle/doric-vm.js | 8 +++++--- doric-js/index.debug.ts | 8 +++++--- doric-js/lib/index.debug.js | 8 +++++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/doric-js/bundle/doric-vm.js b/doric-js/bundle/doric-vm.js index 923e71be..0ab17aae 100644 --- a/doric-js/bundle/doric-vm.js +++ b/doric-js/bundle/doric-vm.js @@ -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; diff --git a/doric-js/index.debug.ts b/doric-js/index.debug.ts index 1b6d9bf2..75705611 100644 --- a/doric-js/index.debug.ts +++ b/doric-js/index.debug.ts @@ -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; diff --git a/doric-js/lib/index.debug.js b/doric-js/lib/index.debug.js index 40290862..aed844c3 100644 --- a/doric-js/lib/index.debug.js +++ b/doric-js/lib/index.debug.js @@ -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;