@live-change/online-service 0.8.50 → 0.8.52

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.
Files changed (2) hide show
  1. package/index.js +6 -6
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -101,7 +101,7 @@ class SelfObservable extends ReactiveDao.Observable {
101
101
  this.setOnlineEventTimeout()
102
102
  }
103
103
  setOnlineEventTimeout() {
104
- if(this.lastEvent == 'online') return
104
+ if(this.lastEvent === 'online') return
105
105
  this.onlineEventTimeout = setTimeout(() => {
106
106
  sendOnlineEvent(this.path)
107
107
  this.lastEvent = 'online'
@@ -109,7 +109,7 @@ class SelfObservable extends ReactiveDao.Observable {
109
109
  }, eventDelay)
110
110
  }
111
111
  setOfflineEventTimeout() {
112
- if(this.lastEvent == 'offline') return
112
+ if(this.lastEvent === 'offline') return
113
113
  this.offlineEventTimeout = setTimeout(() => {
114
114
  sendOfflineEvent(this.path)
115
115
  this.lastEvent = 'offline'
@@ -173,12 +173,12 @@ function getSelfObservable(path) {
173
173
  const onlineDao = {
174
174
  observable([type, ...path]) {
175
175
  console.log("OBSERVABLE", type, path)
176
- if(type!='online') throw new Error("not found")
176
+ if(type !== 'online') throw new Error("not found")
177
177
  return getSelfObservable(path)
178
178
  },
179
179
  get([type, ...path]) {
180
180
  console.log("GET", type, path)
181
- if(type!='online') throw new Error("not found")
181
+ if(type !== 'online') throw new Error("not found")
182
182
  let observable = selfObservables.get(path)
183
183
  return observable ? observable.observers.length : 0
184
184
  },
@@ -191,7 +191,7 @@ const createDao = (clientSessionId) => {
191
191
  return onlineDao
192
192
  }
193
193
 
194
- definition.beforeStart(async service => {
194
+ definition.afterStart(async service => {
195
195
  await sendAllOfflineEvent()
196
196
 
197
197
  const reactiveServer = new ReactiveServer(createDao)
@@ -205,7 +205,7 @@ definition.beforeStart(async service => {
205
205
  reactiveServer.handleConnection(serverConnection)
206
206
  })
207
207
 
208
- console.log(`server started at localhost:${onlinePort}`)
208
+ console.log(`online server started at localhost:${onlinePort}`)
209
209
  })
210
210
 
211
211
  const onlineClient = new ReactiveDaoWebsocket.client("api-server-"+process.pid, onlineUrl)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/online-service",
3
- "version": "0.8.50",
3
+ "version": "0.8.52",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,6 +10,6 @@
10
10
  },
11
11
  "author": "Michał Łaszczewski <michal@emikse.com>",
12
12
  "license": "BSD-3-Clause",
13
- "gitHead": "c967d5304bdac5150a6272c8d7cbe8974d7c25e6",
13
+ "gitHead": "d06ad62415cc92e15b5dee87078614d4f883eb83",
14
14
  "type": "module"
15
15
  }