-
Notifications
You must be signed in to change notification settings - Fork 277
scripting applets
Custom applets may be created within your plugins to add functionality or completely new interfaces. Possibilties range from interfaces that respond to IRC events or messages such as charts or a game interface, to the simple information pages of HTML or forms.
An applet is simple a Backbone.js model that creates a view
property within its initialize
function. This view property is a Backbone.js view that gets rendered as the applets content.
The applet model may also set a title that is displayed on its tab, via the usual this.set('title', 'My Awesome Title');
.
Once your applet has been created, you must then register the applet with Kiwi. This allows the applet to run at any point in the application.
kiwi.components.Applet.register('my_awesome_applet', MyApplet);
Example
var MyAppletView = Backbone.View.extend({
initialize: function() {
this.$el.html('My Awesome Applet');
}
});
var MyApplet = Backbone.Model.extend({
initialize: function() {
this.set('title', 'My Awesome Title');
this.on('applet_loaded', this.appletLoaded, this);
this.view = new MyAppletView({model: this});
},
appletLoaded: function() {
}
});
kiwi.components.Applet.register('my_awesome_applet', MyApplet);
By default the first screen you see when starting Kiwi is the server connection screen. This is an applet itself.
You can change the applet that first loads via:
kiwi.registerStartupApplet('my_awesome_applet')
This will let you create any form of connection screen you like, even if you need it tying in with your existing system.
Officially mirrored at https://kiwiirc.com/docs/