[KSS-checkins] r39833 - kukit/kukit.js/trunk/kukit

reebalazs at codespeak.net reebalazs at codespeak.net
Sat Mar 3 18:15:06 CET 2007


Author: reebalazs
Date: Sat Mar  3 18:15:05 2007
New Revision: 39833

Modified:
   kukit/kukit.js/trunk/kukit/plugin.js
Log:
Add window unload event (document:unload)

Modified: kukit/kukit.js/trunk/kukit/plugin.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/plugin.js	(original)
+++ kukit/kukit.js/trunk/kukit/plugin.js	Sat Mar  3 18:15:05 2007
@@ -66,7 +66,7 @@
 
 kukit.pl.NativeEventBinder.prototype.__bind__node = function(name, func_to_bind, oper) {
     if (oper.node == null) {
-        throw 'Native event must be bound to a node.';
+        throw 'Native event "' + name + '"must be bound to a node.';
     }
     this.__bind__(name, func_to_bind, oper);
 };
@@ -78,6 +78,14 @@
     this.__bind__(name, func_to_bind, oper);
 };
 
+kukit.pl.NativeEventBinder.prototype.__bind__window = function(name, func_to_bind, oper) {
+    if (oper.node != null) {
+        throw 'Native event "' + name + '"must not be bound to a node.';
+    }
+    oper.node = window;
+    this.__bind__(name, func_to_bind, oper);
+};
+
 kukit.pl.NativeEventBinder.prototype.__bind__nodeordocument = function(name, func_to_bind, oper) {
     if (oper.node == null) {
         oper.node = document;
@@ -201,6 +209,7 @@
 kukit.eventsGlobalRegistry.register(null, 'keydown', kukit.pl.NativeEventBinder, '__bind_key__', null);
 kukit.eventsGlobalRegistry.register(null, 'keypress', kukit.pl.NativeEventBinder, '__bind_key__', null);
 kukit.eventsGlobalRegistry.register(null, 'keyup', kukit.pl.NativeEventBinder, '__bind_key__', null);
+kukit.eventsGlobalRegistry.register(null, 'unload', kukit.pl.NativeEventBinder, '__bind__window', null);
 
 /*
 * class TimeoutEventBinder


More information about the Kukit-checkins mailing list