We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Another question re binding (slightly different to #922)
TL;DR. C++ functions registered via bind() with userdata can be called from Javascript, but the promise they return never completes.
bind()
Any thoughts? MTIA.
Much more detail:
2 different C++ functions are registered using bind().
// C++ // 1st variety // sync appears to work in both directions, so JS -> C++ -> JS std::string callout1(const std::string& arg) { std::string ret = std::string("{ \"status\": true }"); std::printf("%s => %s\n", arg.c_str(), ret.c_str()); // JSON status message return ret; } // 3rd variety std::string callout3(const std::string& arg, const std::string& arg2, void* data) { webview::webview* pwv = reinterpret_cast<webview::webview*>(data); std::string ret = std::string("{ \"status\": true }"); std::printf("%s %s (%p) => %s\n", arg.c_str(), arg2.c_str(), pwv, ret.c_str()); // JSON status message return ret; } // both get invoked, but the 2nd form never completes in the .JS script w.bind("callout1", callout1); w.bind("callout3", callout3, userdata);
Log detail from the console (Edge on Windows 10 21H2). The line annoted with *** => shows success
*** =>
callit called callout1 ƒ () { var seq = RPC.nextSeq++; var promise = new Promise(function(resolve, reject) { RPC[seq] = { resolve: resolve, reject: reject, }; ret => Promise {<pending>} *** => index.html:36 success: {status: true} callit called callout3 ƒ () { var seq = RPC.nextSeq++; var promise = new Promise(function(resolve, reject) { RPC[seq] = { resolve: resolve, reject: reject, }; ret => Promise {<pending>}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Another question re binding (slightly different to #922)
TL;DR. C++ functions registered via
bind()
with userdata can be called from Javascript, but the promise they return never completes.Any thoughts? MTIA.
Much more detail:
2 different C++ functions are registered using
bind()
.Log detail from the console (Edge on Windows 10 21H2). The line annoted with
*** =>
shows successThe text was updated successfully, but these errors were encountered: