Open TemporalAgent7 opened 5 years ago
I had to move 'node' code to separate module to invoke it from renderer:
// ./node.js
exports.coolNodeFunction = async function (argument) {
return 'from node';
};
// ./browser.js
const something = await deskgap.asyncNode.require(`./node`);
const result = await something.invoke('coolNodeFunction', 'argument from web').value();
Hi, I'm trying to figure out how
asyncNode
is supposed to be used. I'd like to call node code (that returns a result) from the webview side. I guess one option would be to use the ipc mechanism and build some sort of map of request ids on top of that (similar to electron-promise-ipc), but it looks likeasyncNode
may have been designed to solve this exact problem, except I can't figure out how to use it. Any tips / examples?What I'm looking for is something like this: On the node.js side
On the webview side
I've tried various combinations of
deskgap.asyncNode.getGlobal().invoke()
to no avail.Thank you!