[KSS-checkins] r49582 - kukit/kukit.js/branch/finish-closures/kukit
gotcha at codespeak.net
gotcha at codespeak.net
Sun Dec 9 20:45:01 CET 2007
Author: gotcha
Date: Sun Dec 9 20:45:01 2007
New Revision: 49582
Modified:
kukit/kukit.js/branch/finish-closures/kukit/commandreg.js
Log:
class closure
Modified: kukit/kukit.js/branch/finish-closures/kukit/commandreg.js
==============================================================================
--- kukit/kukit.js/branch/finish-closures/kukit/commandreg.js (original)
+++ kukit/kukit.js/branch/finish-closures/kukit/commandreg.js Sun Dec 9 20:45:01 2007
@@ -28,6 +28,40 @@
*/
var _CommandRegistry = function () {
this.commands = {};
+
+ this.registerFromAction =
+ function(srcname, factory, name) {
+ if (typeof(name) == 'undefined') {
+ // allows to set a different name as the action name,
+ // usable for backward
+ // compatibility setups
+ name = srcname;
+ }
+ // register a given action as a command, using the given vactor
+ var f = kukit.actionsGlobalRegistry.get(srcname);
+ factory(name, f);
+ };
+
+ this.register = function(name, klass) {
+ if (this.commands[name]) {
+ // Do not allow redefinition
+;;; var msg = 'ValueError : command [' + name + '] is already registered.';
+;;; kukit.logError(msg);
+ return;
+ }
+ this.commands[name] = klass;
+ };
+
+ this.get = function(name) {
+ var klass = this.commands[name];
+;;; if (! klass) {
+;;; // not found
+;;; var msg = 'ValueError : no command registered under [' + name + '].';
+;;; kukit.logError(msg);
+;;; }
+ return klass;
+ };
+
};
/*
@@ -44,39 +78,6 @@
* kukit.commandsGlobalRegistry.registerFromAction('replaceInnerHTML',
* kukit.cr.makeSelectorCommand);
*/
-_CommandRegistry.prototype.registerFromAction =
- function(srcname, factory, name) {
- if (typeof(name) == 'undefined') {
- // allows to set a different name as the action name,
- // usable for backward
- // compatibility setups
- name = srcname;
- }
- // register a given action as a command, using the given vactor
- var f = kukit.actionsGlobalRegistry.get(srcname);
- factory(name, f);
-};
-
-_CommandRegistry.prototype.register = function(name, klass) {
- if (this.commands[name]) {
- // Do not allow redefinition
-;;; var msg = 'ValueError : command [' + name + '] is already registered.';
-;;; kukit.logError(msg);
- return;
- }
- this.commands[name] = klass;
-};
-
-_CommandRegistry.prototype.get = function(name) {
- var klass = this.commands[name];
-;;;if (! klass) {
-;;; // not found
-;;; var msg = 'ValueError : no command registered under [' + name + '].';
-;;; kukit.logError(msg);
-;;; }
- return klass;
-};
-
kukit.commandsGlobalRegistry = new _CommandRegistry();
More information about the Kukit-checkins
mailing list