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({