targetj 1.0.55 → 1.0.56

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": "targetj",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "keywords": [
5
5
  "targetj"
6
6
  ],
package/src/App.js CHANGED
@@ -148,6 +148,7 @@ function AppFn(firstChild) {
148
148
  my.manager.nextRuns = [];
149
149
  my.manager.runningStep = 0;
150
150
  my.manager.runningFlag = false;
151
+ my.manager.rerunFlag = false;
151
152
  };
152
153
 
153
154
  my.reset = function() {
@@ -138,11 +138,11 @@ LocationManager.prototype.calculateContainer = function(container) {
138
138
  };
139
139
 
140
140
  LocationManager.prototype.calculateTargets = function(tmodel) {
141
- tapp.targetManager.setTargetValues(tmodel, Object.keys(tmodel.activeTargetKeyMap));
141
+ tapp.targetManager.setTargetValues(tmodel, Object.keys(tmodel.activeTargetMap));
142
142
  tapp.targetManager.setActualValues(tmodel);
143
143
 
144
- if ((!TUtil.isDefined(tmodel.targetValues.width) || tmodel.targetValues.widthFromDom) && tmodel.hasDom()) TargetUtil.setWidthFromDom(tmodel);
145
- if ((!TUtil.isDefined(tmodel.targetValues.height) || tmodel.targetValues.heightFromDom) && tmodel.hasDom()) TargetUtil.setHeightFromDom(tmodel);
144
+ if ((!TUtil.isDefined(tmodel.targetValues.width) || tmodel.getTargetValue('widthFromDom')) && tmodel.hasDom()) TargetUtil.setWidthFromDom(tmodel);
145
+ if ((!TUtil.isDefined(tmodel.targetValues.height) || tmodel.getTargetValue('heightFromDom')) && tmodel.hasDom()) TargetUtil.setHeightFromDom(tmodel);
146
146
  };
147
147
 
148
148
  LocationManager.prototype.addToLocationList = function(child) {
package/src/TModel.js CHANGED
@@ -15,7 +15,7 @@ function TModel(type, targets) {
15
15
 
16
16
  this.type = type ? type : 'blank';
17
17
  this.targets = Object.assign({}, targets);
18
- this.activeTargetKeyMap = {};
18
+ this.activeTargetMap = {};
19
19
  this.resetActiveTargetMap();
20
20
 
21
21
  var uniqueId = App.getOid(this.type);
@@ -114,9 +114,9 @@ TModel.prototype.getDomHolder = function() {
114
114
  TModel.prototype.resetActiveTargetMap = function() {
115
115
  var self = this;
116
116
  this.targetValues = {};
117
- this.activeTargetKeyMap = {};
117
+ this.activeTargetMap = {};
118
118
  Object.keys(this.targets).forEach(function(key) {
119
- self.activeTargetKeyMap[key] = true;
119
+ self.activeTargetMap[key] = true;
120
120
  });
121
121
  };
122
122
 
@@ -727,7 +727,7 @@ TModel.prototype.setTargetValue = function(key, value, steps, stepInterval, cycl
727
727
  TargetUtil.handleValueChange(this, key, this.actualValues[key], oldValue, 0, 0);
728
728
  }
729
729
 
730
- this.activeTargetKeyMap[key] = true;
730
+ this.activeTargetMap[key] = true;
731
731
  this.targetValues[key].executionCount++;
732
732
 
733
733
  this.updateTargetStatus(key);
@@ -772,13 +772,13 @@ TModel.prototype.removeUpdatingChild = function(child) {
772
772
 
773
773
  TModel.prototype.removeTarget = function(key) {
774
774
  delete this.targets[key];
775
- delete this.activeTargetKeyMap[key];
775
+ delete this.activeTargetMap[key];
776
776
  delete this.targetValues[key];
777
777
  };
778
778
 
779
779
  TModel.prototype.addTarget = function(key, target) {
780
780
  this.targets[key] = target;
781
- this.activeTargetKeyMap[key] = true;
781
+ this.activeTargetMap[key] = true;
782
782
  delete this.targetValues[key];
783
783
 
784
784
  tapp.manager.scheduleRun(10, 'addTarget-' + this.oid + "-" + key);
@@ -793,7 +793,7 @@ TModel.prototype.addTargets = function(targets) {
793
793
 
794
794
  TModel.prototype.deleteTargetValue = function(key) {
795
795
  delete this.targetValues[key];
796
- this.activeTargetKeyMap[key] = true;
796
+ this.activeTargetMap[key] = true;
797
797
 
798
798
  tapp.manager.scheduleRun(10, 'deleteTargetValue-' + this.oid + "-" + key);
799
799
  };
@@ -14,7 +14,8 @@ TModelManager.prototype.init = function() {
14
14
  deletedTModel: [],
15
15
  visibleNoDom: [],
16
16
  updatingTModels: [],
17
- updatingTargets: []
17
+ updatingTargets: [],
18
+ activeTargets: []
18
19
  };
19
20
  this.visibleTypeMap = {};
20
21
  this.visibleOidMap = {};
@@ -23,6 +24,7 @@ TModelManager.prototype.init = function() {
23
24
  this.nextRuns = [];
24
25
  this.runningStep = 0;
25
26
  this.runningFlag = false;
27
+ this.rerunFlag = false;
26
28
  };
27
29
 
28
30
  TModelManager.prototype.visibles = function(type, list) {
@@ -47,6 +49,7 @@ TModelManager.prototype.analyze = function() {
47
49
  this.lists.visibleNoDom.length = 0;
48
50
  this.lists.updatingTModels.length = 0;
49
51
  this.lists.updatingTargets.length = 0;
52
+ this.lists.activeTargets.length = 0;
50
53
  this.visibleTypeMap = {};
51
54
  this.visibleOidMap = {};
52
55
  this.targetMethodMap = {};
@@ -72,6 +75,11 @@ TModelManager.prototype.analyze = function() {
72
75
  this.lists.updatingTModels.push(tmodel);
73
76
  this.lists.updatingTargets = this.lists.updatingTargets.concat((tmodel.targetUpdatingList));
74
77
  }
78
+
79
+ var activeTargets = Object.keys(tmodel.activeTargetMap);
80
+ if (activeTargets.length > 0) {
81
+ this.lists.activeTargets = this.lists.activeTargets.concat("'" + tmodel.oid + "'", activeTargets);
82
+ }
75
83
 
76
84
  if (Object.keys(tmodel.targetMethodMap).length > 0) {
77
85
  this.targetMethodMap[tmodel.oid] = Object.assign({}, tmodel.targetMethodMap);
@@ -147,7 +155,7 @@ TModelManager.prototype.deleteDoms = function () {
147
155
  var key = invisible.key;
148
156
  invisible.fn.call(tmodel, key, tmodel.getTargetStep(key), tmodel.getTargetCycle(key), tmodel.getTargetSteps(key), tmodel.getTargetCycles(key));
149
157
  tmodel.setTargetMethodName(key, 'onInvisible');
150
- tmodel.activeTargetKeyMap[key] = true;
158
+ tmodel.activeTargetMap[key] = true;
151
159
  });
152
160
  }
153
161
 
@@ -295,6 +303,8 @@ TModelManager.prototype.scheduleRun = function(delay, oid) {
295
303
  var lastRun = this.nextRuns.length > 0 ? this.nextRuns[this.nextRuns.length - 1] : null;
296
304
  if (nextRun && (!lastRun || nextRun.delay > lastRun.delay)) {
297
305
  this.nextRuns.push(nextRun);
306
+ } else if (nextRun && lastRun && nextRun.delay <= lastRun.delay) {
307
+ tapp.manager.rerunFlag = true;
298
308
  }
299
309
  }
300
310
  };
@@ -390,6 +400,10 @@ TModelManager.prototype.run = function(oid, delay) {
390
400
 
391
401
  if (tapp.manager.runningStep !== 7) {
392
402
  tapp.manager.run("rendering: " + tapp.manager.runningStep);
403
+ } else if (tapp.manager.rerunFlag) {
404
+ tapp.manager.runningStep = 0;
405
+ tapp.manager.rerunFlag = false;
406
+ tapp.manager.run("rerun");
393
407
  } else {
394
408
  tapp.manager.runningStep = 0;
395
409
 
@@ -32,7 +32,7 @@ TargetManager.prototype.setTargetValues = function(tmodel, activeKeys) {
32
32
  if (tmodel.isTargetDone(key)) {
33
33
  this.doneTargets.push({ tmodel: tmodel, key: key });
34
34
  } else if (tmodel.isTargetComplete(key)) {
35
- delete tmodel.activeTargetKeyMap[key];
35
+ delete tmodel.activeTargetMap[key];
36
36
  } else {
37
37
  this.setTargetValue(tmodel, key);
38
38
  tmodel.updateTargetStatus(key);
@@ -54,7 +54,7 @@ TargetManager.prototype.setTargetValue = function(tmodel, key) {
54
54
  var target = tmodel.targets[key];
55
55
 
56
56
  if (!TUtil.isDefined(target)) {
57
- delete tmodel.activeTargetKeyMap[key];
57
+ delete tmodel.activeTargetMap[key];
58
58
  return;
59
59
  }
60
60
 
@@ -65,10 +65,13 @@ TargetManager.prototype.setTargetValue = function(tmodel, key) {
65
65
  }
66
66
 
67
67
  if (!TUtil.isDefined(tmodel.getScheduleTimeStamp(key))) {
68
- TargetUtil.assignValueArray(tmodel, key);
68
+ var newChange = TargetUtil.assignValueArray(tmodel, key);
69
+ if (!newChange) {
70
+ tmodel.targetValues[key].executionCount++;
71
+ }
69
72
  tmodel.setTargetMethodName(key, 'value');
70
73
  }
71
-
74
+
72
75
  var schedulePeriod = TargetUtil.scheduleExecution(tmodel, key);
73
76
  if (schedulePeriod > 0) {
74
77
  tapp.manager.scheduleRun(schedulePeriod, "actualInterval__" + tmodel.oid + "__" + key);
package/src/TargetUtil.js CHANGED
@@ -115,9 +115,9 @@ TargetUtil.assignValueArray = function(tmodel, key) {
115
115
  tmodel.resetTargetStep(key);
116
116
  tmodel.resetLastActualValue(key);
117
117
  }
118
- } else {
119
- tmodel.targetValues[key].executionCount++;
120
- }
118
+
119
+ return true;
120
+ }
121
121
  }
122
122
  };
123
123
 
package/webpack.config.js CHANGED
@@ -7,7 +7,7 @@ module.exports = {
7
7
  name: 'TargetJ',
8
8
  type: 'window'
9
9
  },
10
- path: path.resolve(__dirname, '../targetj/jslib'),
10
+ path: path.resolve(__dirname, './dist'),
11
11
  filename: 'targetj.js'
12
12
  }
13
13
  };