From ac03e40193a4879a612157607e7532f2a2531d22 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 25 Oct 2014 12:01:08 +0400 Subject: [PATCH] now actions.on(..) support event arrays... Signed-off-by: Alex A. Naanou --- ui (gen4)/lib/actions.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/ui (gen4)/lib/actions.js b/ui (gen4)/lib/actions.js index aeaf1ad9..b8a19746 100755 --- a/ui (gen4)/lib/actions.js +++ b/ui (gen4)/lib/actions.js @@ -363,8 +363,10 @@ module.MetaActions = { var handler = typeof(c) == 'function' ? c : b var tag = typeof(c) == 'function' ? b : c + actions = typeof(actions) == 'string' ? actions.split(' ') : actions + var that = this - actions.split(' ').forEach(function(action){ + actions.forEach(function(action){ // prepare the handler... var mode = action.split('.') action = mode[0] @@ -406,13 +408,13 @@ module.MetaActions = { // Remove an action callback... // // XXX needs more testing... - off: function(action, handler){ + off: function(actions, handler){ if(this.hasOwnProperty('_action_handlers')){ - if(action == '*'){ - var actions = Object.keys(this._action_handlers) - } else { - var actions = action.split(' ') - } + + actions = actions == '*' ? Object.keys(this._action_handlers) + : typeof(actions) == 'string' ? action.split(' ') + : actions + var that = this actions.forEach(function(action){ var mode = action.split('.') @@ -455,6 +457,16 @@ module.MetaActions = { } return this }, + + + // NOTE: if 'all' is set them mixin all the actions available, + // otherwise only mixin local actions... + mixin: function(from, all){ + // XXX link actions from 'from' into this... + }, + mixinto: function(to, all){ + return this.mixin.call(to, this, all) + }, }