Place to store the code and config used for the next-Iterations live event.
https://iterations.space/live/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
_kiwi.model.PluginManager = Backbone.Model.extend({
|
|
initialize: function () {
|
|
this.$plugin_holder = $('<div id="kiwi_plugins" style="display:none;"></div>')
|
|
.appendTo(_kiwi.app.view.$el);
|
|
|
|
this.loading_plugins = 0;
|
|
this.loaded_plugins = {};
|
|
},
|
|
|
|
// Load an applet within this panel
|
|
load: function (url) {
|
|
var that = this;
|
|
|
|
if (this.loaded_plugins[url]) {
|
|
this.unload(url);
|
|
}
|
|
|
|
this.loading_plugins++;
|
|
|
|
this.loaded_plugins[url] = $('<div></div>');
|
|
this.loaded_plugins[url].appendTo(this.$plugin_holder)
|
|
.load(url, _.bind(that.pluginLoaded, that));
|
|
},
|
|
|
|
|
|
unload: function (url) {
|
|
if (!this.loaded_plugins[url]) {
|
|
return;
|
|
}
|
|
|
|
this.loaded_plugins[url].remove();
|
|
delete this.loaded_plugins[url];
|
|
},
|
|
|
|
|
|
// Called after each plugin is loaded
|
|
pluginLoaded: function() {
|
|
this.loading_plugins--;
|
|
|
|
if (this.loading_plugins === 0) {
|
|
this.trigger('loaded');
|
|
}
|
|
},
|
|
});
|