targetj 1.0.23 → 1.0.25

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.25",
4
4
  "keywords": [
5
5
  "targetj"
6
6
  ],
package/src/App.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { $Dom } from "./$Dom.js";
2
+ import { TModel } from "./TModel.js";
2
3
  import { browser } from "./Browser.js";
3
4
  import { Dim } from "./Dim.js";
4
5
  import { EventListener } from "./EventListener.js";
@@ -12,7 +13,7 @@ import { TargetManager } from "./TargetManager.js";
12
13
 
13
14
  var tapp;
14
15
 
15
- function App(uiFn, rootId) {
16
+ function App(tmodel, rootId) {
16
17
 
17
18
  function my() {}
18
19
 
@@ -20,12 +21,10 @@ function App(uiFn, rootId) {
20
21
  my.debugLevel = 0;
21
22
 
22
23
  my.runningFlag = false;
23
-
24
- my.oids = {};
25
24
 
26
- my.rootId = rootId ? rootId || uiFn.rootId : "#tpage";
25
+ my.rootId = rootId ? rootId : "#tpage";
27
26
 
28
- my.init = function(uiFn) {
27
+ my.init = function() {
29
28
  browser.setup();
30
29
 
31
30
  my.window = new $Dom(window);
@@ -35,17 +34,27 @@ function App(uiFn, rootId) {
35
34
  }
36
35
  });
37
36
 
38
- my.uiFn = uiFn;
39
- this.ui = uiFn();
40
- this.ui.xVisible = true;
41
- this.ui.yVisible = true;
42
-
43
37
  my.loader = new LoadingManager();
44
38
 
45
39
  my.pagers = new PageManager();
46
40
 
47
41
  my.dim = Dim().measureScreen();
48
42
 
43
+ my.ui = new TModel("ui", {
44
+ width: {
45
+ loop: true, width: function() { return my.dim.screen.width; }
46
+ },
47
+ height: {
48
+ loop: true, height: function() { return my.dim.screen.height; }
49
+ }
50
+ });
51
+ my.ui.xVisible = true;
52
+ my.ui.yVisible = true;
53
+
54
+ if (tmodel) {
55
+ my.ui.addChild(tmodel);
56
+ }
57
+
49
58
  my.events = new EventListener();
50
59
 
51
60
  my.locationManager = new LocationManager();
@@ -56,7 +65,7 @@ function App(uiFn, rootId) {
56
65
 
57
66
  return my;
58
67
  };
59
-
68
+
60
69
  my.start = function () {
61
70
  my.runningFlag = false;
62
71
 
@@ -98,6 +107,10 @@ function App(uiFn, rootId) {
98
107
  return my;
99
108
  };
100
109
 
110
+ my.addChild = function(tmodel) {
111
+ my.ui.addChild(tmodel);
112
+ };
113
+
101
114
  my.resetRuns = function() {
102
115
  my.manager.nextRuns = [];
103
116
  my.manager.runningStep = 0;
@@ -126,31 +139,20 @@ function App(uiFn, rootId) {
126
139
  return SearchUtil.find(oid);
127
140
  };
128
141
 
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
142
  tapp = my;
143
- my.init(uiFn).start();
143
+ my.init().start();
144
144
 
145
145
  return my;
146
146
  }
147
- //
148
- //$Dom.ready(function() {
149
- // window._ = window._ || SearchUtil.find;
150
- //
151
- // if (typeof window.MainT === 'function') {
152
- // App(MainT);
153
- // }
154
- //});
147
+
148
+ App.oids = {};
149
+ App.getOid = function(type) {
150
+ if (!TUtil.isDefined(App.oids[type])) {
151
+ App.oids[type] = 0;
152
+ }
153
+
154
+ var num = App.oids[type]++;
155
+ return { oid: num > 0 ? type + num : type, num: num };
156
+ };
155
157
 
156
158
  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