jsgui3-server 0.0.87 → 0.0.88

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
@@ -40,5 +40,5 @@
40
40
  "type": "git",
41
41
  "url": "https://github.com/metabench/jsgui3-server.git"
42
42
  },
43
- "version": "0.0.87"
43
+ "version": "0.0.88"
44
44
  }
@@ -31,31 +31,49 @@ class Local_Server_Info extends Resource {
31
31
  //this.meta.set('status', 'off');
32
32
  // could use a _ object with proxies.
33
33
  this.status = 'off';
34
+
35
+
36
+ this.getters = {};
37
+
38
+ var getters = {
39
+ 'net': (callback) => {
40
+ callback(null, os.networkInterfaces());
41
+ },
42
+ 'cpus': (callback) => {
43
+ callback(null, os.cpus());
44
+ }
45
+ };
46
+ Object.assign(this.getters, getters);
47
+
34
48
  }
35
49
  // context needs to work properly in call multiple.. need to sort that out.
36
50
  // may need to specify the calling object and the function.
37
51
  // may not just be a pair.
38
52
 
39
53
  'start'(callback) {
54
+
55
+ // Returning observable / optional callback would be better.
56
+ // Switching to observable may be best all round.
57
+
58
+
40
59
  //var that = this;
60
+
61
+ // Super should not be callback start? Seems a little confusing or like it could go wrong here.
62
+
63
+
64
+
41
65
  super.start((err, res_start) => {
42
66
  if (err) {
43
67
  callback(err);
44
68
  } else {
69
+
70
+ console.log('\n start callback \n');
71
+
45
72
  // collections responding to events in their objects?
46
73
  if (this.status === 'off') {
47
74
  //that.meta.set('status', 'starting');
48
75
  this.status = 'starting';
49
-
50
- var getters = {
51
- 'net': (callback) => {
52
- callback(null, os.networkInterfaces());
53
- },
54
- 'cpus': (callback) => {
55
- callback(null, os.cpus());
56
- }
57
- };
58
- Object.assign(this.getters, getters);
76
+
59
77
  this.status = 'on';
60
78
  this.raise_event('started');
61
79
  if (callback) {
package/server.js CHANGED
@@ -350,6 +350,8 @@ class JSGUI_Server extends Evented_Class {
350
350
  var sock_router = rp.get_resource('Server Sock Router');
351
351
  */
352
352
 
353
+ // just lsi.get?
354
+
353
355
  lsi.getters.net((err, net) => {
354
356
  if (err) {
355
357
  callback(err);