Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only create a timeout when required #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions observable-slim.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion observable-slim.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.