Recently I was integrating the new noglobal versions of the library and the new widget into a few apps.

I noticed that currently it feels a little odd that loading the widget and any modules happen implicitly by just importing them. Also there is an inherent order for the imports, in that the RemoteStorage library has to be imported first.

I talked to @raucao about it and we had a few first ideas how this could be improved.

I noticed that currently it feels a little odd that loading the widget and any modules happen implicitly by just importing them. Also there is an inherent order for the imports, in that the RemoteStorage library has to be imported first.

\o/I was thinking about a way to change that too, so this would be more than welcome to me.the only thing I would change in your example would be to have just one package in npm for modules so you will do something like:

about the widget it's ok too, I was also searching another way to specify how to connect the RS instance and the widget when they cannot be in the same context.e.g. in browser extensions, you usually would have the RS instance in background and the widget in the option page or inside a popup page, and scopes are not shared between these pages, but you can communicate via messages or callbacks, so would be great to have another option to connect rs and the widget, but this is a specific case, I think I would implement it if it's ok for you (that would be 2 methods both in RS and widget to send and receive events).

the only thing I would change in your example would be to have just one package in npm for modules [...]

I think the idea of using separate packages for every module is to have them more decentralized. That way each module can have different maintainers. And you can better define dependencies to other modules, including their version.

I like your idea about the message sending and receiving to support different contexts. Especially if that benefits us in using Web workers as @silverbucket mentioned. Please let us know if we can help in any way with that.