quick help if you can. Trying to implement calls to third party native function that accepts an object that has to implement a certain interface with a callback function. How exactly would you create an object like that on the Nativescript side and pass it to that native function?
Java example:
public class Logger {
public static void setListener(LogListener listener) {
// native code
}
}
public interface LogListener {
void onMessageLogged(LogMessage message);
}
So you want to pass in a LogListener
to setListener
?
In TypeScript that would be:
const myLogListener = new change.packagename.LogListener({
onMessageLogged: message => {
console.log(message);
}
});
logger.setListener(myLogListener);