Skip to content

Commit

Permalink
Put namui_sendData in block scope (#958)
Browse files Browse the repository at this point in the history
  • Loading branch information
namse authored Sep 16, 2024
1 parent 94bbdf1 commit f233fa5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions namui/namui-cli/webCode/src/insertJs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit f233fa5

Please sign in to comment.