Flipboard / Flipboard/GoldenGate
How to call method with JS callback
- Dominant language
- Java
- Stars
- 119
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
is possible to call method with JS callback?
Example:
```
Library.prototype.fetch = function(url,cb,scope) {
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.readyState==4 && request.status==200) {
cb.call(scope,request.responseText);
}
}
request.open("GET",url,true);
request.send();
}
```
In JS call looks like this:
```
instanceOfLibrary.fetch('_URL_', function(data) {document.getElementById("output").innerHTML = "
Fetched:
"+data+"";
```
If yes, could I ask how to define the callback in interface?
```
@Method("instanceOfLibrary.fetch")
void fetch(String url, ???? , Callback callback);
```
Thank you in advance for any hint!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.