dbm 1.0.5 → 1.0.6

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.
@@ -94,13 +94,13 @@ export default class JsonLoader extends Dbm.core.BaseObject {
94
94
  }
95
95
 
96
96
  _callback_request(aResponse) {
97
- console.log("_callback_request");
97
+ //console.log("_callback_request");
98
98
  aResponse.on("data", this._callback_dataBound);
99
99
  aResponse.on("end", this._callback_endBound);
100
100
  }
101
101
 
102
102
  _callback_data(aData) {
103
- console.log("_callback_data");
103
+ //console.log("_callback_data");
104
104
  this.item.rawData += aData;
105
105
  }
106
106
 
@@ -112,9 +112,10 @@ export default class JsonLoader extends Dbm.core.BaseObject {
112
112
  }
113
113
 
114
114
  _callback_end() {
115
- console.log("_callback_end");
116
- console.log(this.item.rawData);
115
+ //console.log("_callback_end");
116
+ //console.log(this.item.rawData);
117
117
  this._setData(this.item.rawData);
118
+ this.item.status = Dbm.loading.LoadingStatus.LOADED;
118
119
  }
119
120
 
120
121
  _setData(aData) {
@@ -122,7 +123,7 @@ export default class JsonLoader extends Dbm.core.BaseObject {
122
123
  }
123
124
 
124
125
  load() {
125
- console.log("load");
126
+ //console.log("load");
126
127
 
127
128
  if(this.item.status !== Dbm.loading.LoadingStatus.NOT_STARTED) {
128
129
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbm",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {},
@@ -0,0 +1,40 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class IntervalTimer extends Dbm.core.BaseObject {
4
+ _construct() {
5
+ super._construct();
6
+
7
+ this.item.setValue("running", false);
8
+ this._requestId = -1;
9
+ this.item.setValue("update", function() {});
10
+
11
+ this._updateBound = this._update.bind(this);
12
+ }
13
+
14
+ _update(aTime) {
15
+
16
+ this.item.update(aTime);
17
+
18
+ }
19
+
20
+ start() {
21
+ if(!this.item.running) {
22
+ this.item.running = true;
23
+ this._requestId = setInterval(this._updateBound, 10);
24
+ }
25
+
26
+ return this;
27
+ }
28
+
29
+ stop() {
30
+ if(this.item.running) {
31
+ this.item.running = false;
32
+ if(this._requestId) {
33
+ clearInterval(this._requestId);
34
+ this._requestId = -1;
35
+ }
36
+ }
37
+
38
+ return this;
39
+ }
40
+ }
package/updater/index.js CHANGED
@@ -2,6 +2,7 @@ import Dbm from "../index.js";
2
2
 
3
3
  export {default as PropertyUpdater} from "./PropertyUpdater.js";
4
4
  export {default as RequestAnimationFrameTimer} from "./RequestAnimationFrameTimer.js";
5
+ export {default as IntervalTimer} from "./IntervalTimer.js";
5
6
 
6
7
  let webSetup = function() {
7
8
  let updater = new Dbm.updater.PropertyUpdater();
@@ -13,4 +14,16 @@ let webSetup = function() {
13
14
  updater.start();
14
15
  }
15
16
 
16
- export {webSetup};
17
+ export {webSetup};
18
+
19
+ let nodeSetup = function() {
20
+ let updater = new Dbm.updater.PropertyUpdater();
21
+ updater.item.register("propertyUpdater");
22
+
23
+ let timer = new Dbm.updater.IntervalTimer();
24
+ updater.setTimer(timer.item);
25
+
26
+ updater.start();
27
+ }
28
+
29
+ export {nodeSetup};