Comparing version 0.1.7 to 0.1.8
{ | ||
"name": "scheming", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"main": "dest/Scheming.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -636,5 +636,2 @@ (function() { | ||
type = normalizedSchema[propName].type; | ||
if (val === void 0) { | ||
return; | ||
} | ||
if (type.string === NESTED_TYPES.Schema.string) { | ||
@@ -644,7 +641,7 @@ if (typeof unwatchers[propName] === "function") { | ||
} | ||
unwatchers[propName] = val.watch(function(newVal, oldVal) { | ||
unwatchers[propName] = val != null ? val.watch(function(newVal, oldVal) { | ||
return cm.queueChanges(id, propName, oldVal, fireWatchers); | ||
}, { | ||
internal: true | ||
}); | ||
}) : void 0; | ||
} | ||
@@ -655,7 +652,9 @@ if (type.string === NESTED_TYPES.Array.string && type.childType.string === NESTED_TYPES.Schema.string) { | ||
unwatcher = _ref[_i]; | ||
unwatcher(); | ||
if (typeof unwatcher === "function") { | ||
unwatcher(); | ||
} | ||
} | ||
unwatchers[propName] = []; | ||
return _.each(val, function(schema, i) { | ||
return unwatchers[propName].push(schema.watch(function(newVal, oldVal) { | ||
return unwatchers[propName].push(schema != null ? schema.watch(function(newVal, oldVal) { | ||
var oldArray; | ||
@@ -667,3 +666,3 @@ oldArray = _.cloneDeep(instance[propName]); | ||
internal: true | ||
})); | ||
}) : void 0); | ||
}); | ||
@@ -673,3 +672,3 @@ } | ||
fireWatchers = function(queuedChanges, target) { | ||
var e, getPrevVal, newVals, oldVals, propName, shouldFire, triggeringProperties, watcher, _i, _j, _len, _len1, _ref, _ref1, _results; | ||
var e, getPrevVal, i, newVals, oldVals, propName, shouldFire, triggeringProperties, watcher, _i, _len, _ref, _results; | ||
if (target == null) { | ||
@@ -686,6 +685,6 @@ target = 'external'; | ||
}; | ||
_ref = watchers[target]; | ||
i = 0; | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
watcher = _ref[_i]; | ||
while ((watcher = watchers[target][i])) { | ||
i++; | ||
shouldFire = watcher.first || (_.intersection(triggeringProperties, watcher.properties).length > 0); | ||
@@ -696,5 +695,5 @@ watcher.first = false; | ||
oldVals = {}; | ||
_ref1 = watcher.properties; | ||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | ||
propName = _ref1[_j]; | ||
_ref = watcher.properties; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
propName = _ref[_i]; | ||
newVals[propName] = instance[propName]; | ||
@@ -701,0 +700,0 @@ oldVals[propName] = getPrevVal(propName); |
{ | ||
"name": "scheming", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"main": "./dest/Scheming.js", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/autoric/scheming", |
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
461063
2292