reactive-plugin-system
reactive-plugin-system
is an addon / extension / plugin system for JavaScript.
It uses RxJS5 to handle asynchronous loading
and unloading of plugins. Plugins can depend on each other.
Example
A simple plugin system that uses require
to load plugins.
some-app.js
; const plugins = data: 'shared' getFactory: factoryLoadersrequire ; plugins; ;
plugin-a/index.js
PluginA
loads asynchronously and uses shared data.
{ thisdata = data; } { console; } { return RxObservable // wait a second ;}
plugin-b/index.js
PluginB
depends on PluginA
.
{ thispluginA = pluginA; } { thispluginA; } { return pluginSystem ;}
plugin-c/index.js
PluginC
needs to clean up in the end.
; { // do cleanup } { return { const pluginC = ; observernext pluginC ; observercomplete; return pluginC; } ;}