Skip to content

Commit

Permalink
♻️ Refactor some Base class methods
Browse files Browse the repository at this point in the history
  • Loading branch information
skerit committed Jan 18, 2024
1 parent f019ad1 commit 0abd8e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
12 changes: 5 additions & 7 deletions lib/core/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,18 @@ Base.setStatic(function startNewGroup(value) {
*
* @author Jelle De Loecker <[email protected]>
* @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;
Expand Down Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions lib/core/client_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
});
}
});
Expand Down

0 comments on commit 0abd8e1

Please sign in to comment.