targetj 1.0.23 → 1.0.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": "targetj",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "keywords": [
5
5
  "targetj"
6
6
  ],
package/src/App.js CHANGED
@@ -12,7 +12,7 @@ import { TargetManager } from "./TargetManager.js";
12
12
 
13
13
  var tapp;
14
14
 
15
- function App(uiFn, rootId) {
15
+ function App(tmodel, rootId) {
16
16
 
17
17
  function my() {}
18
18
 
@@ -20,12 +20,10 @@ function App(uiFn, rootId) {
20
20
  my.debugLevel = 0;
21
21
 
22
22
  my.runningFlag = false;
23
-
24
- my.oids = {};
25
23
 
26
- my.rootId = rootId ? rootId || uiFn.rootId : "#tpage";
24
+ my.rootId = rootId ? rootId : "#tpage";
27
25
 
28
- my.init = function(uiFn) {
26
+ my.init = function() {
29
27
  browser.setup();
30
28
 
31
29
  my.window = new $Dom(window);
@@ -35,17 +33,27 @@ function App(uiFn, rootId) {
35
33
  }
36
34
  });
37
35
 
38
- my.uiFn = uiFn;
39
- this.ui = uiFn();
40
- this.ui.xVisible = true;
41
- this.ui.yVisible = true;
42
-
43
36
  my.loader = new LoadingManager();
44
37
 
45
38
  my.pagers = new PageManager();
46
39
 
47
40
  my.dim = Dim().measureScreen();
48
41
 
42
+ my.ui = new TModel("ui", {
43
+ width: {
44
+ loop: true, width: function() { return my.dim.screen.width; }
45
+ },
46
+ height: {
47
+ loop: true, height: function() { return my.dim.screen.height; }
48
+ }
49
+ });
50
+ my.ui.xVisible = true;
51
+ my.ui.yVisible = true;
52
+
53
+ if (tmodel) {
54
+ my.ui.addChild(tmodel);
55
+ }
56
+
49
57
  my.events = new EventListener();
50
58
 
51
59
  my.locationManager = new LocationManager();
@@ -56,7 +64,7 @@ function App(uiFn, rootId) {
56
64
 
57
65
  return my;
58
66
  };
59
-
67
+
60
68
  my.start = function () {
61
69
  my.runningFlag = false;
62
70
 
@@ -98,6 +106,10 @@ function App(uiFn, rootId) {
98
106
  return my;
99
107
  };
100
108
 
109
+ my.addUI = function(tmodel) {
110
+ my.ui.addChild(tmodel);
111
+ };
112
+
101
113
  my.resetRuns = function() {
102
114
  my.manager.nextRuns = [];
103
115
  my.manager.runningStep = 0;
@@ -126,31 +138,20 @@ function App(uiFn, rootId) {
126
138
  return SearchUtil.find(oid);
127
139
  };
128
140
 
129
- my.getOid = function(type) {
130
- if (!TUtil.isDefined(my.oids[type])) {
131
- my.oids[type] = 0;
132
- }
133
-
134
- var num = my.oids[type]++;
135
- return { oid: num > 0 ? type + num : type, num: num };
136
- };
137
-
138
- my.brackets = function(oid) {
139
- return tapp.locationManager.bracketMap[oid] ? tapp.locationManager.bracketMap[oid].list : null;
140
- };
141
-
142
141
  tapp = my;
143
- my.init(uiFn).start();
142
+ my.init().start();
144
143
 
145
144
  return my;
146
145
  }
147
- //
148
- //$Dom.ready(function() {
149
- // window._ = window._ || SearchUtil.find;
150
- //
151
- // if (typeof window.MainT === 'function') {
152
- // App(MainT);
153
- // }
154
- //});
146
+
147
+ App.oids = {};
148
+ App.getOid = function(type) {
149
+ if (!TUtil.isDefined(App.oids[type])) {
150
+ App.oids[type] = 0;
151
+ }
152
+
153
+ var num = App.oids[type]++;
154
+ return { oid: num > 0 ? type + num : type, num: num };
155
+ };
155
156
 
156
157
  export { tapp, App };
@@ -28,7 +28,7 @@ PageManager.prototype.openPage = function(link, isPageFetchNeeded) {
28
28
  data: { tpageOnly: true },
29
29
  success: function (data) {
30
30
  tapp.$dom.outerHTML(data);
31
- tapp.ui = tapp.uiFn();
31
+ tapp.resetUI();
32
32
  self.lastLink = link;
33
33
  tapp.start();
34
34
  },
@@ -40,7 +40,7 @@ PageManager.prototype.openPage = function(link, isPageFetchNeeded) {
40
40
 
41
41
  } else if (!this.pageCache[link]) {
42
42
  tapp.$dom.innerHTML("");
43
- tapp.ui = tapp.uiFn();
43
+ tapp.resetUI();
44
44
  self.lastLink = link;
45
45
  setTimeout(tapp.start);
46
46
  } else {
package/src/TModel.js CHANGED
@@ -1,4 +1,4 @@
1
- import { tapp } from "./App.js";
1
+ import { tapp, App } from "./App.js";
2
2
  import { browser } from "./Browser.js";
3
3
  import { SearchUtil } from "./SearchUtil.js";
4
4
  import { TUtil } from "./TUtil.js";
@@ -14,7 +14,7 @@ function TModel(type, targets) {
14
14
 
15
15
  this.type = type ? type : TUtil.getTypeFromCallerFile() || 'blank';
16
16
  this.targets = Object.assign({}, targets);
17
- var uniqueId = tapp.getOid(this.type);
17
+ var uniqueId = App.getOid(this.type);
18
18
  this.oid = uniqueId.oid;
19
19
  this.oidNum = uniqueId.num;
20
20