Add asyncRunner in the periodic callbacks

This commit is contained in:
benweet 2013-04-21 15:36:53 +01:00
parent 5b1b97a161
commit 9553b28132
5 changed files with 12 additions and 9 deletions

View File

@ -142,6 +142,8 @@ define([ "core", "underscore" ], function(core) {
// Use defer to avoid stack overflow // Use defer to avoid stack overflow
_.defer(runTask); _.defer(runTask);
}; };
// Run runTask function periodically
core.addPeriodicCallback(asyncRunner.runTask);
function runSafe(task, callbacks, param) { function runSafe(task, callbacks, param) {
try { try {

2
js/main-min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -35,6 +35,8 @@ define(["jquery", "core", "github-provider", "blogger-provider", "dropbox-provid
$(".action-force-publish").removeClass("disabled"); $(".action-force-publish").removeClass("disabled");
} }
}; };
// Run updatePublishButton function on online/offline event
core.addOfflineListener(publisher.updatePublishButton);
// Apply template to the current document // Apply template to the current document
publisher.applyTemplate = function(publishAttributes) { publisher.applyTemplate = function(publishAttributes) {
@ -204,8 +206,6 @@ define(["jquery", "core", "github-provider", "blogger-provider", "dropbox-provid
}; };
$(function() { $(function() {
core.addOfflineListener(publisher.updatePublishButton);
// Init each provider // Init each provider
_.each(providerMap, function(provider) { _.each(providerMap, function(provider) {
// Publish provider button // Publish provider button

View File

@ -28,6 +28,8 @@ define(["jquery", "core", "dropbox-provider", "gdrive-provider", "underscore"],
$(".action-force-sync").removeClass("disabled"); $(".action-force-sync").removeClass("disabled");
} }
}; };
// Run updateSyncButton on online/offline event
core.addOfflineListener(synchronizer.updateSyncButton);
// Force the synchronization // Force the synchronization
synchronizer.forceSync = function() { synchronizer.forceSync = function() {
@ -181,6 +183,8 @@ define(["jquery", "core", "dropbox-provider", "gdrive-provider", "underscore"],
}); });
}); });
}; };
// Run sync function periodically
core.addPeriodicCallback(synchronizer.sync);
// Used to populate the "Manage synchronization" dialog // Used to populate the "Manage synchronization" dialog
var lineTemplate = ['<div class="input-prepend input-append">', var lineTemplate = ['<div class="input-prepend input-append">',
@ -233,9 +237,6 @@ define(["jquery", "core", "dropbox-provider", "gdrive-provider", "underscore"],
}; };
$(function() { $(function() {
core.addOfflineListener(synchronizer.updateSyncButton);
core.addPeriodicCallback(synchronizer.sync);
// Init each provider // Init each provider
_.each(providerMap, function(provider) { _.each(providerMap, function(provider) {
// Provider's import button // Provider's import button