diff --git a/observable-slim.js b/observable-slim.js index c362267..7e5220f 100644 --- a/observable-slim.js +++ b/observable-slim.js @@ -366,9 +366,8 @@ var ObservableSlim = (function() { // will need to stop monitoring this object and any nested objects underneath the overwritten object else they'll become // orphaned and grow memory usage. we execute this on a setTimeout so that the clean-up process does not block // the UI rendering -- there's no need to execute the clean up immediately - setTimeout(function() { - - if (typeOfTargetProp === "object" && targetProp !== null) { + if (typeOfTargetProp === "object" && targetProp !== null) { + setTimeout(function() { // check if the to-be-overwritten target property still exists on the target object // if it does still exist on the object, then we don't want to stop observing it. this resolves @@ -445,8 +444,8 @@ var ObservableSlim = (function() { } })(targetProp) - } - },10000); + },10000); + } } // TO DO: the next block of code resolves test case #29, but it results in poor IE11 performance with very large objects. diff --git a/observable-slim.min.js b/observable-slim.min.js index d0db5fb..3ad20ae 100644 --- a/observable-slim.min.js +++ b/observable-slim.min.js @@ -1 +1 @@ -function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var ObservableSlim=function(){var e=[],r=[],t=[],n=[],o=null,a=function a(l,i,u,s){var f=u||null,g=s||[{target:l,property:""}];e.push(g),l instanceof Array&&(l.__length=l.length);var p=[],c=function(e,r,t){for(var n="",o=null,a=0;a-1&&null!==t[o.__targetPosition])for(var l=n[o.__targetPosition],u=0,s=l.length;u-1){for(var s=n[u],g=s.length;g--;)if(f===s[g].observable){s.splice(g,1);break}0==s.length&&(t[u]=null)}}(u)}},1e4)}}s&&v(p.length)}return!0}},h=l.__targetPosition;h>-1||Object.defineProperty(l,"__targetPosition",{value:t.length,writable:!1,enumerable:!1,configurable:!1});var y=new Proxy(l,b);null===f&&(f={parentTarget:l,domDelay:i,parentProxy:y,observers:[],paused:!1,path:g,changesPaused:!1},r.push(f));var _={target:l,proxy:y,observable:f};return h>-1?(null===t[h]&&(t[h]=l),n[h].push(_)):(t.push(l),n.push([_])),y};return{create:function(e,r,t){if(!0===e.__isProxy)e=e.__getTarget;var n=a(e,r);return"function"==typeof t&&this.observe(n,t),function e(r){for(var t=r.__getTarget,n=Object.keys(t),o=0,a=n.length;o-1&&null!==t[o.__targetPosition])for(var l=n[o.__targetPosition],u=0,s=l.length;u-1){for(var s=n[u],g=s.length;g--;)if(f===s[g].observable){s.splice(g,1);break}0==s.length&&(t[u]=null)}}(u)},1e4)}}s&&v(p.length)}return!0}},h=l.__targetPosition;h>-1||Object.defineProperty(l,"__targetPosition",{value:t.length,writable:!1,enumerable:!1,configurable:!1});var y=new Proxy(l,b);null===f&&(f={parentTarget:l,domDelay:i,parentProxy:y,observers:[],paused:!1,path:g,changesPaused:!1},r.push(f));var _={target:l,proxy:y,observable:f};return h>-1?(null===t[h]&&(t[h]=l),n[h].push(_)):(t.push(l),n.push([_])),y};return{create:function(e,r,t){if(!0===e.__isProxy)e=e.__getTarget;var n=a(e,r);return"function"==typeof t&&this.observe(n,t),function e(r){for(var t=r.__getTarget,n=Object.keys(t),o=0,a=n.length;o