Hi all, I'm using CloudKVS and trying to figure out a wait-for-data situation using events and resumable subs.
I define my cloudKVS instance in a common code module called "c" (which I try to use for all global variables).
I create the instance in my Starter module:
And I have my NewData event handler for RefreshUser in the Starter module too:
In another activity, I'd like to call RefreshUser and wait for the results before continuing, so I wrote this:
(For now, let's assume that there are always updates that fire the NewData event.)
The problem so far is that the original event handler in my Starter module fires, but the one in the other activity doesn't. I thought it would because its inline event handler should take precedence over the Starter one, wouldn't it?
Anyway, I'm relatively new to async/resumable subs and events, so happy to be corrected. Thanks!
I define my cloudKVS instance in a common code module called "c" (which I try to use for all global variables).
I create the instance in my Starter module:
B4X:
c.ckvs.Initialize(Me, "ckvs", c.SYNC_URL, c.DB_FILENAME)
And I have my NewData event handler for RefreshUser in the Starter module too:
B4X:
Sub ckvs_NewData
...
End Sub
In another activity, I'd like to call RefreshUser and wait for the results before continuing, so I wrote this:
B4X:
c.ckvs.RefreshUser(c.userEmail)
wait for ckvs_NewData
'code continues here once the event happens
(For now, let's assume that there are always updates that fire the NewData event.)
The problem so far is that the original event handler in my Starter module fires, but the one in the other activity doesn't. I thought it would because its inline event handler should take precedence over the Starter one, wouldn't it?
Anyway, I'm relatively new to async/resumable subs and events, so happy to be corrected. Thanks!