Open curran opened 8 years ago
The API could look something like this:
Chiasm.registerPlugin(pluginName, constructor);
Chiasm.registerPlugins(plugins);
var chiasm1 = Chiasm();
chiasm1.registerPlugin(pluginName, constructor);
chiasm1.registerPlugins(plugins);
var chiasm2 = Chiasm(chiasm1);
chiasm2.registerPlugin(pluginName, constructor);
chiasm2.registerPlugins(plugins);
This should use prototypal inheritence. This would enable nested Chiasm instances, as is required for small multiples https://github.com/chiasm-project/chiasm/issues/60
In the case that the browser global
Chiasm
is defined at the time a given module is loaded (included as ascript
tag), that module should be able to register itself as a plugin in the Chiasm runtime. For this, theplugins
object for Chiasm could use prototypal inheritence, and inherit from a global set of plugins.Examples would be much simpler (no Chiasm boilerplate with plugin assignment necessary). Only a single
<script>
tag would be necessary to include a Chiasm component on a page. It must be placed after the Chiasm runtime script,chiasm.js
.The following modules should have UMD builds that automatically register themselves:
registerPlugins
to register all chart typesregisterPlugin
to register itself