add some basic doc strings

This commit is contained in:
Damien Churchill 2010-01-26 17:26:53 +00:00
parent 454321614b
commit dc764b2ad5
1 changed files with 61 additions and 31 deletions

View File

@ -1,6 +1,6 @@
/*
Script: Deluge.Plugin.js
Contains a base class for plugins to extend.
Contains a base class for plugins to extend.
Copyright:
(C) Damien Churchill 2009 <damoxc@gmail.com>
@ -20,36 +20,66 @@ Copyright:
51 Franklin Street, Fifth Floor
Boston, MA 02110-1301, USA.
In addition, as a special exception, the copyright holders give
permission to link the code of portions of this program with the OpenSSL
library.
You must obey the GNU General Public License in all respects for all of
the code used other than OpenSSL. If you modify file(s) with this
exception, you may extend this exception to your version of the file(s),
but you are not obligated to do so. If you do not wish to do so, delete
this exception statement from your version. If you delete this exception
statement from all source files in the program, then also delete it here.
In addition, as a special exception, the copyright holders give
permission to link the code of portions of this program with the OpenSSL
library.
You must obey the GNU General Public License in all respects for all of
the code used other than OpenSSL. If you modify file(s) with this
exception, you may extend this exception to your version of the file(s),
but you are not obligated to do so. If you do not wish to do so, delete
this exception statement from your version. If you delete this exception
statement from all source files in the program, then also delete it here.
*/
/**
* @class Deluge.Plugin
* @extends Ext.util.Observable
*/
Deluge.Plugin = Ext.extend(Ext.util.Observable, {
constructor: function(config) {
this.name = config.name;
this.addEvents({
"enabled": true,
"disabled": true
});
this.isDelugePlugin = true;
Deluge.Plugins[this.name] = this;
Deluge.Plugin.superclass.constructor.call(this, config);
},
disable: function() {
this.fireEvent("disabled", this);
if (this.onDisable) this.onDisable();
},
enable: function() {
this.fireEvent("enable", this);
if (this.onEnable) this.onEnable();
}
});
/**
* The plugins name
* @property name
* @type {String}
*/
name: null,
constructor: function(config) {
this.name = config.name;
this.addEvents({
/**
* @event enabled
* @param {Plugin} plugin the plugin instance
*/
"enabled": true,
/**
* @event disabled
* @param {Plugin} plugin the plugin instance
*/
"disabled": true
});
this.isDelugePlugin = true;
Deluge.Plugins[this.name] = this;
Deluge.Plugin.superclass.constructor.call(this, config);
},
/**
* Disables the plugin, firing the "{@link #disabled}" event and
* then executing the plugins clean up method onDisabled.
*/
disable: function() {
this.fireEvent("disabled", this);
if (this.onDisable) this.onDisable();
},
/**
* Enables the plugin, firing the "{@link #enabled}" event and
* then executes the plugins setup method, onEnabled.
*/
enable: function() {
this.fireEvent("enable", this);
if (this.onEnable) this.onEnable();
}
});