From 0eb6e785d01a31993dba72b2689dbf173b3eea7d Mon Sep 17 00:00:00 2001 From: Reza Fatahi Date: Tue, 22 Sep 2015 19:24:37 -0700 Subject: [PATCH 1/4] Node cleanup convenience method --- core/Node.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/core/Node.js b/core/Node.js index eed38ad0..b753c00f 100644 --- a/core/Node.js +++ b/core/Node.js @@ -1287,4 +1287,31 @@ Node.prototype.dismount = function dismount () { if (!this._requestingUpdate) this._requestUpdate(); }; -module.exports = Node; +/** + * Removes Node states to mask visibility in context switching + * with optional context + * + * @method + * + * @return null + */ +Node.prototype.cleanup = function cleanup (ctx) { + try { + var was = this; + was._UIEvents.forEach(function(e) { + was.removeUIEvent(e); + }); + was._components.forEach(function(c) { + c.setProperty('background-color', 'transparent') + .setContent(''); + was.removeComponent(c); + }); + was.setSizeMode('absolute', 'absolute') + .setAbsoluteSize(0, 0); + if (ctx) ctx.removeChild(was); + } catch(e) { + throw e + }; +}; + + module.exports = Node; \ No newline at end of file From 5946622eb322a1179c1ed19334f88a512d05b040 Mon Sep 17 00:00:00 2001 From: Reza Fatahi Date: Tue, 22 Sep 2015 19:47:20 -0700 Subject: [PATCH 2/4] lint corrections on adding cleanup to core/Node --- core/Node.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/Node.js b/core/Node.js index b753c00f..0743c079 100644 --- a/core/Node.js +++ b/core/Node.js @@ -1309,9 +1309,10 @@ Node.prototype.cleanup = function cleanup (ctx) { was.setSizeMode('absolute', 'absolute') .setAbsoluteSize(0, 0); if (ctx) ctx.removeChild(was); - } catch(e) { - throw e - }; + } + catch (e) { + throw e; + } }; - module.exports = Node; \ No newline at end of file + module.exports = Node; From 2694ac4c6bde938287192bb6d081275b65f67575 Mon Sep 17 00:00:00 2001 From: Reza Fatahi Date: Tue, 22 Sep 2015 20:04:57 -0700 Subject: [PATCH 3/4] jsdoc corrections on adding cleanup to core/Node --- core/Node.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/Node.js b/core/Node.js index 0743c079..8464876f 100644 --- a/core/Node.js +++ b/core/Node.js @@ -1291,9 +1291,11 @@ Node.prototype.dismount = function dismount () { * Removes Node states to mask visibility in context switching * with optional context * - * @method + * @method cleanup + * + * @param {Object} [ctx] Optional context * - * @return null + * @returns {void} */ Node.prototype.cleanup = function cleanup (ctx) { try { From 3db73eb8c52a1b61f31abbba5b58f6ad8e63b62b Mon Sep 17 00:00:00 2001 From: Reza Fatahi Date: Tue, 22 Sep 2015 20:13:32 -0700 Subject: [PATCH 4/4] improved method descriptor of cleanup core/Node --- core/Node.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Node.js b/core/Node.js index 8464876f..07c14f7a 100644 --- a/core/Node.js +++ b/core/Node.js @@ -1288,8 +1288,8 @@ Node.prototype.dismount = function dismount () { }; /** - * Removes Node states to mask visibility in context switching - * with optional context + * Removes selected Node visual states during context switching + * of parents creating new nodes, with optional context * * @method cleanup *