From 0abd8e1875b3e0faf3206af5d95258a5f613d2ed Mon Sep 17 00:00:00 2001 From: Jelle De Loecker Date: Thu, 18 Jan 2024 12:38:07 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20some=20Base=20c?= =?UTF-8?q?lass=20methods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/core/base.js | 12 +++++------- lib/core/client_base.js | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/core/base.js b/lib/core/base.js index 6c44cd02..06adf878 100644 --- a/lib/core/base.js +++ b/lib/core/base.js @@ -233,20 +233,18 @@ Base.setStatic(function startNewGroup(value) { * * @author Jelle De Loecker * @since 1.0.0 - * @version 1.0.0 + * @version 1.4.0 */ Base.setStatic(function getAllChildren() { - var result = [], - i; + let result = []; if (!this.children) { return result; } - for (i = 0; i < this.children.length; i++) { - result.push(this.children[i]); - result.include(this.children[i].getAllChildren()); + for (let child of this.children) { + result.push(child, ...child.getAllChildren()); } return result; @@ -585,7 +583,7 @@ Base.setMethod(function getModel(name, init, options) { } if (!init) { - return Model.get(name, false); + return Model.get(name, false, options); } if (!options) { diff --git a/lib/core/client_base.js b/lib/core/client_base.js index 2ec36dfb..f6dcb203 100644 --- a/lib/core/client_base.js +++ b/lib/core/client_base.js @@ -200,7 +200,7 @@ ClientBase.setStatic(function setMethod(key, method, on_server) { */ ClientBase.setStatic(function mapEventToMethod(event_name, method_name) { - function doMap() { + function addEventMap() { if (!this.event_to_method_map) { this.setStatic('event_to_method_map', new Map(), false); @@ -219,11 +219,11 @@ ClientBase.setStatic(function mapEventToMethod(event_name, method_name) { } } - this.constitute(doMap); + this.constitute(addEventMap); if (Blast.isNode) { this.callbackWithServerClass(function gotClass(ServerClass) { - ServerClass.constitute(doMap); + ServerClass.constitute(addEventMap); }); } });