TVML JS EventListenerObject

157 views Asked by At

I'm trying to use the event system for TVML and am running into issues/lack of documentation. The TVML JS Kit documentation hints at there being a ElementListenerObject but I'm having trouble setting it up. Has anyone seen any further documentation or examples of how this works?

Specifically I'm trying to solve a problem where I calling into JavaScript code after a long running Swift method and need to let certain objects know of the results

1

There are 1 answers

1
ant_Ti On BEST ANSWER

One of the options is to use deferred execution from Swift code. You will have to create global function in js and then tell your Swift code its name. When Swift code will be ready to populate result you just need to execute that global function. This technic is similar to JSONP.

Here is how it could be implemented in swift

And how to use it in js