@live-change/dao 0.5.2 → 0.5.3

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.
@@ -1,11 +1,13 @@
1
1
 
2
2
  class InboxReader {
3
- constructor(observableFunction, callback, start = '', bucketSize = 32, idField = 'id') {
3
+ constructor(observableFunction, callback, start = '', bucketSize = 32, idField = 'id',
4
+ positionFilterCallback = (n, curr) => n > curr ) {
4
5
  this.observableFunction = observableFunction
5
6
  this.position = start
6
7
  this.callback = callback
7
8
  this.bucketSize = bucketSize
8
9
  this.idField = idField
10
+ this.positionFilterCallback = positionFilterCallback
9
11
 
10
12
  this.observable = null
11
13
  this.queue = []
@@ -57,7 +59,7 @@ class InboxReader {
57
59
  }
58
60
 
59
61
  handleMessage(message) {
60
- if(message[this.idField] <= this.position) return // ignore
62
+ if(!this.positionFilterCallback(message[this.idField], this.position)) return // ignore
61
63
  this.position = message[this.idField]
62
64
  this.queue.push(message)
63
65
  }
@@ -30,15 +30,15 @@ class ObservableList extends Observable {
30
30
  }
31
31
  }
32
32
 
33
- push(value) {
33
+ push(...values) {
34
34
  this.handleError(null)
35
- this.list.push(value)
36
- this.fireObservers('push', value)
35
+ this.list.push(values)
36
+ this.fireObservers('push', ...values)
37
37
  }
38
- unshift(value) {
38
+ unshift(...values) {
39
39
  this.handleError(null)
40
- this.list.unshift(value)
41
- this.fireObservers('unshift', value)
40
+ this.list.unshift(...values)
41
+ this.fireObservers('unshift', ...values)
42
42
  }
43
43
  pop() {
44
44
  this.handleError(null)
package/package.json CHANGED
@@ -35,6 +35,6 @@
35
35
  "scripts": {
36
36
  "test": "NODE_ENV=test blue-tape tests/*"
37
37
  },
38
- "version": "0.5.2",
39
- "gitHead": "9706615162cae0a4539f2e6bd1e2d5ab5babf5cd"
38
+ "version": "0.5.3",
39
+ "gitHead": "8c748d3469847811f3f8a5ca245e641eb2da286e"
40
40
  }