Great stuff, this is very easy to implement than my loop and its faster also.
Anyway, in the result below
firebase is my library class instance, this references a child class named
messaging so that all messaging subs runs from their separate concern.
This is defined as
Public messaging As FBMessaging
and I initialize it from a sub called Connect with
messaging.Initialize(firebase, vapidKey, ServerKey)
So in my
messaging class, I have added this sub
Sub subscribeToTopicsWait(topics As List) As Boolean
Dim fetches As List
fetches.Initialize
For Each strtopic As String In topics
Dim fetch As BANanoFetch = subscribe(strtopic)
fetches.Add(fetch)
Next
Dim ResultsAll() As BANanoFetchResponse 'ignore
ResultsAll = BANAno.Await(BANAno.PromiseAll(fetches))
Return True
End Sub
When I run
Dim Done As Boolean = banano.Await(firebase.messaging.subscribeToTopicsWait(mytopics))
Log(Done)
This results in this error
// [446] Dim mytopics As List = Array As String( {242} , sdeviceid, stel1, stel2, stopicarea)
_mytopics=["topic",_sdeviceid,_stel1,_stel2,_stopicarea];
// [451] Dim Done As Boolean = banano.Await(firebase.messaging.subscribeToTopicsWait(mytopics))
_done=await _B._firebase.await _messaging.subscribetotopicswait(_mytopics);
// [452] Log(Done)
console.log(_done);
If however I take the subscribeToTopicsWait sub and put it on the root of my library class it works perfectly. This is when I call it with
Dim Done As Boolean = banano.Await(firebase.subscribeToTopicsWait(mytopics))
Log(Done)
I also update it for the root class to reference the messaging class like this.
Sub subscribeToTopicsWait(topics As List) As Boolean
Dim fetches As List
fetches.Initialize
For Each strtopic As String In topics
Dim fetch As BANanoFetch = messaging.subscribe(strtopic)
fetches.Add(fetch)
Next
Dim ResultsAll() As BANanoFetchResponse 'ignore
ResultsAll = BANano.Await(BANano.PromiseAll(fetches))
Return True
End Sub
Is there a way to fix this as I would not want to bloat the root library class? or perhaps call it differently so that it does not break and result in this?
_done=await _B._firebase.await _messaging.subscribetotopicswait(_mytopics);
Thanks