From 14c1d319ee068d79dfbeee5af97f1caa69778934 Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Fri, 4 Jul 2014 08:40:26 -0500 Subject: Tweaking syncfs task --- src/js/pre.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/js') diff --git a/src/js/pre.js b/src/js/pre.js index 0fc1e50..35321f9 100644 --- a/src/js/pre.js +++ b/src/js/pre.js @@ -54,8 +54,8 @@ gnunet_prerun = function() { // removeRunDependency("randomness") // Mount IDBFS for services that use it - var match; - if (match = location.pathname.match('gnunet-service-(.*).js')) { + var match = location.pathname.match('gnunet-service-(.*).js'); + if (match) { var service = match[1]; var mounts = {peerinfo: true, fs: true, nse: true}; if (mounts[service]) { @@ -64,8 +64,12 @@ gnunet_prerun = function() { FS.mount(IDBFS, {}, mount); addRunDependency('syncfs'); FS.syncfs(true, function() { removeRunDependency('syncfs'); }); + var syncfs_task; var sync_callback = function() { - setTimeout(function() { FS.syncfs(false, sync_callback); }, 5000); + clearTimeout(syncfs_task); + syncfs_task = setTimeout(function() { + FS.syncfs(false, sync_callback); + }, 5000); }; sync_callback(); } -- cgit v1.2.3-18-g5258