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

@ -350,7 +350,7 @@
</div>
<div class="control-group modal-publish-gdrive">
<div class="controls muted">
If no filename is supplied, the document title will be used.
If no file name is supplied, the document title will be used.
</div>
</div>

View File

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

2
js/main-min.js vendored

File diff suppressed because one or more lines are too long

View File

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

View File

@ -28,6 +28,8 @@ define(["jquery", "core", "dropbox-provider", "gdrive-provider", "underscore"],
$(".action-force-sync").removeClass("disabled");
}
};
// Run updateSyncButton on online/offline event
core.addOfflineListener(synchronizer.updateSyncButton);
// Force the synchronization
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
var lineTemplate = ['<div class="input-prepend input-append">',
@ -232,10 +236,7 @@ define(["jquery", "core", "dropbox-provider", "gdrive-provider", "underscore"],
return providerIdList;
};
$(function() {
core.addOfflineListener(synchronizer.updateSyncButton);
core.addPeriodicCallback(synchronizer.sync);
$(function() {
// Init each provider
_.each(providerMap, function(provider) {
// Provider's import button