Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Remove deprecated window.dirtyCheck(); use Platform.flush() instead. …
Browse files Browse the repository at this point in the history
…Fixes issue #10
  • Loading branch information
sorvell committed Sep 3, 2013
1 parent 8ce81d0 commit fe5a959
Showing 1 changed file with 9 additions and 24 deletions.
33 changes: 9 additions & 24 deletions src/patches-mdv.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,26 @@ style.textContent = 'template {display: none !important;} /* injected by platfor
var head = document.querySelector('head');
head.insertBefore(style, head.firstChild);

// dirtyCheck (with logging)
function dirtyCheck() {
logFlags.data && console.group("Platform.performMicrotaskCheckpoint()");
check();
logFlags.data && console.groupEnd();
};

// call notifyChanges in Model scope
function check() {
// flush (with logging)
function flush() {
logFlags.data && console.group("Platform.flush()");
scope.endOfMicrotask(Platform.performMicrotaskCheckpoint);
logFlags.data && console.groupEnd();
};

var dirtyCheckPollInterval = 125;

// polling dirty checker
var FLUSH_POLL_INTERVAL = 125;
window.addEventListener('WebComponentsReady', function() {
// timeout keeps the profile clean
//setTimeout(function() {
//console.profile('initial model dirty check');
dirtyCheck();
//console.profileEnd();
//}, 0);

// dirty check periodically if platform does not have object observe.
flush();
// flush periodically if platform does not have object observe.
if (!Observer.hasObjectObserve) {
scope.dirtyPoll = setInterval(check, dirtyCheckPollInterval);
scope.flushPoll = setInterval(flush, FLUSH_POLL_INTERVAL);
}
});

// exports
scope.flush = dirtyCheck;

// deprecated

window.dirtyCheck = dirtyCheck;
scope.flush = flush;

})(window.Platform);

0 comments on commit fe5a959

Please sign in to comment.