@live-change/dao 0.3.8 → 0.3.9
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,17 +1,17 @@
|
|
|
1
1
|
const ObservableList = require("./ObservableList.js")
|
|
2
2
|
|
|
3
3
|
class ExtendedObservableList extends ObservableList {
|
|
4
|
-
constructor(observableList, elementActivator, elementDispose) {
|
|
4
|
+
constructor(observableList, elementActivator, elementDispose, valueActivator = observableList.valueActivator) {
|
|
5
5
|
let list = observableList.list
|
|
6
6
|
if(elementActivator) {
|
|
7
7
|
list = Array.isArray(list) ? list.map(elementActivator) : elementActivator(list)
|
|
8
8
|
}
|
|
9
|
-
super(list)
|
|
9
|
+
super(list, undefined, undefined, valueActivator)
|
|
10
10
|
|
|
11
11
|
this.observableList = observableList
|
|
12
12
|
this.elementActivator = elementActivator
|
|
13
13
|
this.elementDispose = elementDispose
|
|
14
|
-
this.valueActivator =
|
|
14
|
+
this.valueActivator = valueActivator
|
|
15
15
|
|
|
16
16
|
this.savedError = null
|
|
17
17
|
this.properties = []
|
package/lib/ObservableProxy.js
CHANGED
|
@@ -15,6 +15,7 @@ class ObservableProxy extends Observable {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
setTarget(observable) {
|
|
18
|
+
if(this === observable) throw new Error('infinite loop')
|
|
18
19
|
if(!this.disposed && this.observable) {
|
|
19
20
|
this.observable.unobserve(this.observer)
|
|
20
21
|
for(let [object, property] of this.properties) {
|
|
@@ -80,8 +81,8 @@ class ObservableProxy extends Observable {
|
|
|
80
81
|
unbindProperty(object, property) {
|
|
81
82
|
for(var i = 0; i < this.properties.length; i++) {
|
|
82
83
|
var prop = this.properties[i]
|
|
83
|
-
if(prop[0]
|
|
84
|
-
this.properties.splice(i,1)
|
|
84
|
+
if(prop[0] === object && prop[1] === property) {
|
|
85
|
+
this.properties.splice(i, 1)
|
|
85
86
|
if(this.observable) this.observable.unbindProperty(object, property)
|
|
86
87
|
if(this.isUseless()) this.dispose()
|
|
87
88
|
return
|
package/package.json
CHANGED