From da9e099cf5c181014b4dccb9be71a39e101f16d4 Mon Sep 17 00:00:00 2001 From: Kevin Glowacz Date: Tue, 28 Jul 2009 04:53:08 +0000 Subject: [PATCH] (trunk web) load the initial preferences asynchronously --- web/javascript/transmission.js | 7 ++++--- web/javascript/transmission.remote.js | 12 ++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/web/javascript/transmission.js b/web/javascript/transmission.js index 4999bf5a5..b61e6817e 100644 --- a/web/javascript/transmission.js +++ b/web/javascript/transmission.js @@ -113,19 +113,20 @@ Transmission.prototype = // Get preferences & torrents from the daemon var tr = this; - this.loadDaemonPrefs( ); + var async = false; + this.loadDaemonPrefs( async ); this.initalizeAllTorrents(); this.togglePeriodicRefresh( true ); }, - loadDaemonPrefs: function(){ + loadDaemonPrefs: function( async ){ var tr = this; this.remote.loadDaemonPrefs( function(data){ var o = data.arguments; Prefs.getClutchPrefs( o ); tr.updatePrefs( o ); - }); + }, async ); }, preloadImages: function() { diff --git a/web/javascript/transmission.remote.js b/web/javascript/transmission.remote.js index dc3bbf290..933b4e19d 100644 --- a/web/javascript/transmission.remote.js +++ b/web/javascript/transmission.remote.js @@ -72,8 +72,11 @@ TransmissionRemote.prototype = XHR.setRequestHeader('X-Transmission-Session-Id', this._token); }, - sendRequest: function( data, success ) { + sendRequest: function( data, success, async ) { remote = this; + if( typeof async != 'boolean' ) + async = true; + $.ajax( { url: RPC._Root, type: 'POST', @@ -83,14 +86,15 @@ TransmissionRemote.prototype = data: $.toJSON(data), beforeSend: function(XHR){ remote.appendSessionId(XHR) }, error: function(request, error_string, exception){ remote.ajaxError(request, error_string, exception, this) }, - success: success + success: success, + async: async } ); }, - loadDaemonPrefs: function( callback ) { + loadDaemonPrefs: function( callback, async ) { var tr = this._controller; var o = { method: 'session-get' }; - this.sendRequest( o, callback ); + this.sendRequest( o, callback, async ); }, getInitialDataFor: function(torrent_ids, callback) {