Ah, I misunderstood the question.
You can try this.
Send a message from webview when it loads:
webviewApi.postMessage("getData")
In the plugin, return the promise and save a refernce to it
var sendData;
joplin.views.panels.onMessage(resourceSearch, async (msg: Message) => {
return new Promise((resolve) => {
sendData = resolve;
})
// and then later when you have the data, call
sendData(data);
1 Like