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
Right now defineModule calls the builder immediately, storing the module instance in an object. Once loadModule is called, the instance gets added to the remoteStorage object, and access is claimed on the corresponding paths. One reason to call the builder immediately within defineModule, is that this way module information (such as it's dataHints) is available without loading the module (which IMHO should be referred to as enabling the module, as it doesn't really load anything - the code has to be loaded already).
Now this brings trouble when the module wants to do initialization, that involves data. For example the calendar module calls privateBaseClient.sync('/'). This brings two problems:
in this specific case, this creates an empty directory node "calendar/", which confuses my tests
data is being accessed without claiming access to the directory. In reality this line probably won't do anything, because at the point where the module is defined, access cannot have been claimed, unless the user was just reloading the page, being connected already.
I can think of two ways to solve this:
introduce a module initializer, that is called once the module is loaded
only call the builder, when loading a module.
I prefer (1). Any thoughts on naming? initialize? onload? Anyway, it probably shouldn't be part of the exports but an additional key to the module's definition.
The text was updated successfully, but these errors were encountered:
Right now
defineModule
calls the builder immediately, storing the module instance in an object. OnceloadModule
is called, the instance gets added to theremoteStorage
object, and access is claimed on the corresponding paths. One reason to call the builder immediately withindefineModule
, is that this way module information (such as it's dataHints) is available without loading the module (which IMHO should be referred to as enabling the module, as it doesn't really load anything - the code has to be loaded already).Now this brings trouble when the module wants to do initialization, that involves data. For example the calendar module calls
privateBaseClient.sync('/')
. This brings two problems:I can think of two ways to solve this:
I prefer (1). Any thoughts on naming?
initialize
?onload
? Anyway, it probably shouldn't be part of the exports but an additional key to the module's definition.The text was updated successfully, but these errors were encountered: