If you read the text of the function, you'll see that the word "async" appears in it =] As that suggests, firing an even like this in FireBreath is asynchronous and does not allow you to give it a return value in any way. Because of the way events are implemented on some browsers there is no reasonable way to change that.
That said, you can do your own thing by having a function that you pass in a FB::JSObjectPtr
to be stored and used as a callback; if you call that callback using Invoke
with ""
as the method name it will call the javascript function and return the value, like so:
bool MyScriptingAPI::setCallback(const FB::JSObjectPtr& callback) {
FB::variant res = callback->Invoke("", FB::variant_list_of("some")(3)("arguments"));
return res.convert_cast<bool>();
}
This will call your callback, cast the result to bool (true/false) and return the result to javascript. Obviously if something that can't cast to a bool is returned, an exception will be thrown, but you should get the general idea.