From 9b2f6e39b019765e33593d4ab9636c9d51431631 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 29 Aug 2014 19:19:21 +0400 Subject: [PATCH] minor simplification in client.js Signed-off-by: Alex A. Naanou --- ui (gen4)/client.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/ui (gen4)/client.js b/ui (gen4)/client.js index add8a7ed..e35ef4c1 100755 --- a/ui (gen4)/client.js +++ b/ui (gen4)/client.js @@ -15,6 +15,15 @@ data = require('data') +function proxy(attr, name){ + return function(){ + this[attr][name].apply(this[attr], arguments) + return this + } +} + + + /*********************************************************************/ var CLIENT_ACTIONS = { @@ -23,12 +32,8 @@ var CLIENT_ACTIONS = { // .data // - focusImage: doc('Focus Image', - // XXX do we need to account for event first argument here??? - function(gid){ - this.data.focusImage(gid) - return this - }), + focusImage: doc('Focus Image', + proxy('data', 'focusImage')), // target can be: // - current @@ -36,6 +41,7 @@ var CLIENT_ACTIONS = { // - before // - after // + // XXX should this be implemented here on in data.js???? focusRibbon: doc('Focus ribbon', function(target){ var cur = this.data.getRibbonIndex() @@ -48,6 +54,11 @@ var CLIENT_ACTIONS = { return this.focusImage( this.data.getImage(ribbon, direction)) }), + + firstImage: doc('', + proxy('data', 'firstImage')), + lastImage: doc('', + proxy('data', 'lastImage')), }