Last active
December 16, 2015 21:59
-
-
Save pegli/5503830 to your computer and use it in GitHub Desktop.
pass a native function call to a KrollFunction invocation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MyModule = require('com.obscure.module'); | |
var proxy = MyModule.createMyProxy(); | |
proxy.foogle(function(cb) { | |
cb('hello, world!'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
E/JNIUtil ( 681): !!! Unable to convert unknown Java object class 'com.obscure.MyProxy$1$1' to Js value !!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void doSomething() { | |
} | |
@Kroll.method | |
public void foogle(KrollFunction callback) { | |
final MyProxy self = this; | |
callback.call(this.getKrollObject(), new Object[] { | |
new KrollFunction() { | |
public Object call(KrollObject krollObject, Object[] args) { | |
self.doSomething(); | |
} | |
} | |
/* the rest of the KrollFunction methods elided */ | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment