@urso/core 0.7.23 → 0.7.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urso/core",
3
- "version": "0.7.23",
3
+ "version": "0.7.24",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -1,5 +1,5 @@
1
1
  class ModulesLogicController {
2
- constructor() {
2
+ constructor() {
3
3
  this._baseLogicBlocks = ['main', 'sounds'];
4
4
  const additionalLogicBlocks = this.getAdditionalLogicBlocks();
5
5
  this.logicBlocks = [...this._baseLogicBlocks, ...additionalLogicBlocks];
@@ -7,16 +7,16 @@ class ModulesLogicController {
7
7
  this._instances = {};
8
8
  this._init();
9
9
  };
10
-
11
- _init(){
10
+
11
+ _init() {
12
12
  this._createLogicInstances();
13
13
  };
14
14
 
15
- getAdditionalLogicBlocks(){
15
+ getAdditionalLogicBlocks() {
16
16
  return [];
17
17
  };
18
18
 
19
- _createLogicInstances(){
19
+ _createLogicInstances() {
20
20
  //console.log('[Modules.Brain.Controller]', ' Creating logic blocks:', JSON.stringify(this.logicBlocks));
21
21
 
22
22
  for (let i = 0; i < this.logicBlocks.length; i++) {
@@ -26,23 +26,27 @@ class ModulesLogicController {
26
26
  }
27
27
  };
28
28
 
29
- do(){
29
+ /**
30
+ * launch function with current name (first agrument) per each logic block (if exists)
31
+ * @returns {Mixed}
32
+ */
33
+ do() {
30
34
  const results = [];
31
- const params = [ ...arguments ];
32
- const funName = params.shift();
35
+ const params = [...arguments];
36
+ const functionName = params.shift();
33
37
 
34
38
  for (let blockName in this._instances) {
35
39
  const instance = this._instances[blockName];
36
40
 
37
- if(instance && instance[funName]){
38
- results[blockName] = instance[funName].apply(this, params);
41
+ if (instance && instance[functionName]) {
42
+ results[blockName] = instance[functionName].apply(this, params);
39
43
  }
40
44
  }
41
45
 
42
- return results;
46
+ return results;
43
47
  };
44
48
 
45
- _subscribe(){};
49
+ _subscribe() { };
46
50
  }
47
51
 
48
52
  module.exports = ModulesLogicController;