From dff333b558cb29f1c6fa6d13ee4239a9bc0a81a6 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Tue, 27 Jan 2015 11:53:45 +0200 Subject: client: remove state variable in node view and use bacon property instead --- src/client/view/tab.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/client/view/tab.js') diff --git a/src/client/view/tab.js b/src/client/view/tab.js index 97ba1351..9fca9a29 100644 --- a/src/client/view/tab.js +++ b/src/client/view/tab.js @@ -1,12 +1,13 @@ "use strict" -define(['jquery'], -function($) { +define(['jquery', 'Bacon'], +function($, Bacon) { function Tab(dict) { var k, selector = {}, - name = []; + name = [], + openessBus = new Bacon.Bus(); for (k in dict) { if (dict.hasOwnProperty(k) == false) { @@ -17,6 +18,8 @@ function Tab(dict) { } this._selector = selector; this._name = name; + this._openessBus = openessBus; + this.isOpenProperty = openessBus.toProperty(false) } Tab.prototype.show = function(shown_name) { @@ -33,6 +36,7 @@ Tab.prototype.show = function(shown_name) { element.hide(); } } + this._openessBus.push(true); } Tab.prototype.hide = function() { @@ -41,6 +45,7 @@ Tab.prototype.hide = function() { for (i = 0 ; i < this._name.length ; ++i) { $(this._selector[this._name[i]]).fadeOut(300); } + this._openessBus.push(false); } Tab.prototype.get = function(name, sel) { -- cgit v1.3.1