diff --git a/modules/core/context.js b/modules/core/context.js index e9ac76134..91de61ca5 100644 --- a/modules/core/context.js +++ b/modules/core/context.js @@ -135,21 +135,21 @@ export function coreContext() { context.loadTiles = function(projection, callback) { - if (connection && context.editable()) { - var cid = connection.getConnectionId(); - utilCallWhenIdle(function() { + utilCallWhenIdle(function() { + if (connection && context.editable()) { + var cid = connection.getConnectionId(); connection.loadTiles(projection, afterLoad(cid, callback)); - })(); - } + } + })(); }; context.loadTileAtLoc = function(loc, callback) { - if (connection && context.editable()) { - var cid = connection.getConnectionId(); - utilCallWhenIdle(function() { + utilCallWhenIdle(function() { + if (connection && context.editable()) { + var cid = connection.getConnectionId(); connection.loadTileAtLoc(loc, afterLoad(cid, callback)); - })(); - } + } + })(); }; context.loadEntity = function(entityID, callback) { diff --git a/modules/util/idle.js b/modules/util/idle.js index 103e0eded..9b2765c47 100644 --- a/modules/util/idle.js +++ b/modules/util/idle.js @@ -25,8 +25,7 @@ export function utilIdleWorker(tasks, processor, callback) { callback(results); })(); - // alternatively, each task deferred in its own callback - // seems to not work because it + // alternatively, each task deferred in its own callback seems to not work // var processed = []; // var currentPos = 0;