Comparing version 0.1.10 to 1.0.0
{ | ||
"name": "scheming", | ||
"version": "0.1.10", | ||
"version": "1.0.0", | ||
"main": "dest/Scheming.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -483,4 +483,5 @@ (function() { | ||
ChangeManager.prototype.queueChanges = function(id, propName, oldVal, fireWatchers) { | ||
var changedProps, _base; | ||
ChangeManager.prototype.queueChanges = function(_arg, fireWatchers) { | ||
var changedProps, equals, id, newVal, oldVal, propName, _base; | ||
id = _arg.id, propName = _arg.propName, oldVal = _arg.oldVal, newVal = _arg.newVal, equals = _arg.equals; | ||
if (!_.has(this.changes, id)) { | ||
@@ -496,5 +497,8 @@ if ((_base = this.changes)[id] == null) { | ||
changedProps = this.changes[id].changedProps; | ||
if (propName && !_.has(changedProps, propName)) { | ||
changedProps[propName] = oldVal; | ||
this.internalChangeQueue.push(id); | ||
if (propName) { | ||
if (_.has(changedProps, propName) && equals(changedProps[propName], newVal)) { | ||
delete changedProps[propName]; | ||
} else if (!_.has(changedProps, propName) && !equals(oldVal, newVal)) { | ||
changedProps[propName] = oldVal; | ||
} | ||
} | ||
@@ -578,7 +582,11 @@ return this.timeout != null ? this.timeout : this.timeout = setTimeout(this.resolve, 0); | ||
} | ||
if (!type.equals(prevVal, val)) { | ||
data[propName] = val; | ||
watchForPropagation(propName, val); | ||
return cm.queueChanges(id, propName, prevVal, fireWatchers); | ||
} | ||
data[propName] = val; | ||
watchForPropagation(propName, val); | ||
return cm.queueChanges({ | ||
id: id, | ||
propName: propName, | ||
oldVal: prevVal, | ||
newVal: val, | ||
equals: type.equals | ||
}, fireWatchers); | ||
}; | ||
@@ -629,3 +637,5 @@ get = function(propName) { | ||
watchers[target].push(watcher); | ||
cm.queueChanges(id, null, null, fireWatchers); | ||
cm.queueChanges({ | ||
id: id | ||
}, fireWatchers); | ||
return function() { | ||
@@ -646,3 +656,9 @@ return removeWatcher(watcher, target); | ||
unwatchers[propName] = val != null ? val.watch(function(newVal, oldVal) { | ||
return cm.queueChanges(id, propName, oldVal, fireWatchers); | ||
return cm.queueChanges({ | ||
id: id, | ||
propName: propName, | ||
oldVal: oldVal, | ||
newVal: newVal, | ||
equals: type.equals | ||
}, fireWatchers); | ||
}, { | ||
@@ -663,6 +679,13 @@ internal: true | ||
return unwatchers[propName].push(schema != null ? schema.watch(function(newVal, oldVal) { | ||
var oldArray; | ||
oldArray = _.cloneDeep(instance[propName]); | ||
var newArray, oldArray; | ||
newArray = instance[propName]; | ||
oldArray = _.cloneDeep(newArray); | ||
oldArray[i] = oldVal; | ||
return cm.queueChanges(id, propName, oldArray, fireWatchers); | ||
return cm.queueChanges({ | ||
id: id, | ||
propName: propName, | ||
oldVal: oldArray, | ||
newVal: newArray, | ||
equals: type.equals | ||
}, fireWatchers); | ||
}, { | ||
@@ -669,0 +692,0 @@ internal: true |
{ | ||
"name": "scheming", | ||
"version": "0.1.10", | ||
"version": "1.0.0", | ||
"main": "./dest/Scheming.js", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/autoric/scheming", |
@@ -455,3 +455,3 @@ # Scheming! | ||
Snchronous changes will be reflected when the watcher fires. | ||
Synchronous changes will be reflected when the watcher fires. | ||
``` | ||
@@ -467,3 +467,3 @@ lisa.name = 'lisa' | ||
lisa.watch 'name', (newVal, oldVal) -> | ||
# this listner is called once | ||
# this listener is called once | ||
newVal == 'lisa' | ||
@@ -480,7 +480,14 @@ oldVal == undefined | ||
lisa.watch ['name', 'age'], (newVal, oldVal) -> | ||
# newVal == {name : 'lisa', age : 7} | ||
# oldVal == {name : undefined, age : undefined} | ||
lisa.name = 'lisa' | ||
lisa.age = 7 | ||
``` | ||
# Changelog | ||
## v1.0.0 | ||
- Initial release | ||
@@ -490,2 +497,5 @@ | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
467612
2334
1
498