Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
mape
Level 7

Re: Creating RAF instance - in Task and not

"EnTerr" wrote:
Btw, one does not need really to persist the Roku_Ads() result. Calling it repeatedly is "cheap" so just assign it in local variable (e.g. `ads` and not `m.ads`) every time needed.

I try to create Roku-Ads()in the Scene,init(), and got this error:

BRIGHTSCRIPT: ERROR: roAppInfo: class PLUGIN|MARKUP on thread RENDER: roku_ads_lib:/Roku_Ads.brs(560)
BRIGHTSCRIPT: ERROR: roMessagePort: Trying to construct a message port on a non-plugin thread: roku_ads_lib:/Roku_Ads.brs(335)
BRIGHTSCRIPT: ERROR: roUrlTransfer: class PLUGIN|MARKUP on thread RENDER: roku_ads_lib:/Roku_Ads.brs(336)

So, to create Roku_Ads() 'any time' is not so easy Smiley Sad
0 Kudos
EnTerr
Level 9

Re: Creating RAF instance - in Task and not

"mape" wrote:
"EnTerr" wrote:
Btw, one does not need really to persist the Roku_Ads() result. Calling it repeatedly is "cheap" so just assign it in local variable (e.g. `ads` and not `m.ads`) every time needed.

Really? Sounds good.
But, i think to separate it to the Task will be useful to share it between different Scenes and Players. 

That is already done internally, it is being shared every time you call Roku_Ads(). I.e. RAF is already smart and does not create new instances on each invocation. To throw a buzzword, do you know the "signleton pattern"? RAF is a singleton already.
0 Kudos
mape
Level 7

Re: Creating RAF instance - in Task and not

"EnTerr" wrote:
"mape" wrote:
 

That is already done internally, it is being shared every time you call Roku_Ads(). I.e. RAF is already smart and does not create new instances on each invocation. To throw a buzzword, do you know the "signleton pattern"? RAF is a singleton already.

Got it, thank you. 
0 Kudos