jockeyjs
jockeyjs copied to clipboard
Callback with data
Hello -
I noticed when I send a message using the Jockey send method, there's no way to receive data back in the callback.
Is there a reason that this wasn't included? I.e., would it be possible to get the following with the callback function receiving a payload from the app?
Jockey.send("event-name", {
key: "value"
}, function() {
alert("iOS has finished processing!");
});
Hmm. It was never meant for two way communication within the same event, but I don't see why it wouldn't be possible. At worst (for now), you could just fire a new event from the iOS side in response with the data you're looking to send back.
If you'd like to fix that up and issue a PR, I wouldn't be against it. You'd need to be able to handle the case where you're returning the iOS response from multiple iOS observers on the JS-triggered event. How you'd do that eloquently though, I'm not sure.
To accept the PR, I'd need the reverse, however, where iOS sends a message and receives data from the JS side in response as well.