From f233fa594c6bdce972e4fb56bbbc1cc690eecf28 Mon Sep 17 00:00:00 2001 From: Nam Se Hyun <3580430+namse@users.noreply.github.com> Date: Mon, 16 Sep 2024 20:04:49 +0900 Subject: [PATCH] Put namui_sendData in block scope (#958) --- namui/namui-cli/webCode/src/insertJs.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/namui/namui-cli/webCode/src/insertJs.ts b/namui/namui-cli/webCode/src/insertJs.ts index bbd050ba3..9db1c406b 100644 --- a/namui/namui-cli/webCode/src/insertJs.ts +++ b/namui/namui-cli/webCode/src/insertJs.ts @@ -112,13 +112,14 @@ export function insertJsHandleOnMainThread( sendDataQueueMap: new Map(), }); - script.textContent = `const namui_sendData = (data) => { - window.namui_onDataFromJs(${jsId}, data); - } - ${js} - window.namui_onDrop_${jsId} = namui_onDrop; - window.namui_onDataFromRust_${jsId} = namui_onData; - `; + script.textContent = `{ + const namui_sendData = (data) => { + window.namui_onDataFromJs(${jsId}, data); + } + ${js} + window.namui_onDrop_${jsId} = namui_onDrop; + window.namui_onDataFromRust_${jsId} = namui_onData; + }`; document.body.appendChild(script); }, onInsertJsDrop({