zjquery: Add support for off().

This commit is contained in:
Steve Howell
2018-03-25 09:28:49 -04:00
committed by Tim Abbott
parent 4886d92405
commit f97fe7842e

View File

@@ -145,6 +145,21 @@ exports.make_zjquery = function () {
generic_event('keyup', arg);
return self;
},
off: function () {
var event_name;
if (arguments.length === 2) {
event_name = arguments[0];
on_functions[event_name] = [];
} else if (arguments.length === 3) {
event_name = arguments[0];
var sel = arguments[1];
var child_on = child_on_functions.setdefault(sel, new Dict());
child_on[event_name] = [];
}
return self;
},
on: function () {
// parameters will either be
// (event_name, handler) or