You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into this recently and think it might be useful to add to the docs that the on('connect') callback will only fire AFTER you make a call (I make a dummy call to org.rdk.System.getDeviceInfo).
This problem becomes apparent when the on('connect') callback needs to handle async functions before anything else is executed.
classCustomClass{constructor(){this.thunderJS=ThunderJS({host: '127.0.0.1',port: 9998})}init(){returnnewPromise((resolve,reject)=>{this.thunderJS.on('connect',()=>{console.log('connected')// In the real world this would be some async functionsreturnresolve()})// Dummy call required to trigger the connect callback (without it it will never fire)constdummyCall=awaitthis.thunderJS.call('org.rdk.System','getDeviceInfo')})}};(async()=>{constcc=newCustomClass()awaitcc.init()console.log('finished loading')// Will log if dummyCall exists, but won't if commented out})()
The text was updated successfully, but these errors were encountered:
I ran into this recently and think it might be useful to add to the docs that the
on('connect')
callback will only fire AFTER you make a call (I make a dummy call toorg.rdk.System.getDeviceInfo
).This problem becomes apparent when the
on('connect')
callback needs to handle async functions before anything else is executed.The text was updated successfully, but these errors were encountered: