1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00

(trunk web) load the initial preferences asynchronously

This commit is contained in:
Kevin Glowacz 2009-07-28 04:53:08 +00:00
parent 1901c44bf0
commit da9e099cf5
2 changed files with 12 additions and 7 deletions

View file

@ -113,19 +113,20 @@ Transmission.prototype =
// Get preferences & torrents from the daemon // Get preferences & torrents from the daemon
var tr = this; var tr = this;
this.loadDaemonPrefs( ); var async = false;
this.loadDaemonPrefs( async );
this.initalizeAllTorrents(); this.initalizeAllTorrents();
this.togglePeriodicRefresh( true ); this.togglePeriodicRefresh( true );
}, },
loadDaemonPrefs: function(){ loadDaemonPrefs: function( async ){
var tr = this; var tr = this;
this.remote.loadDaemonPrefs( function(data){ this.remote.loadDaemonPrefs( function(data){
var o = data.arguments; var o = data.arguments;
Prefs.getClutchPrefs( o ); Prefs.getClutchPrefs( o );
tr.updatePrefs( o ); tr.updatePrefs( o );
}); }, async );
}, },
preloadImages: function() { preloadImages: function() {

View file

@ -72,8 +72,11 @@ TransmissionRemote.prototype =
XHR.setRequestHeader('X-Transmission-Session-Id', this._token); XHR.setRequestHeader('X-Transmission-Session-Id', this._token);
}, },
sendRequest: function( data, success ) { sendRequest: function( data, success, async ) {
remote = this; remote = this;
if( typeof async != 'boolean' )
async = true;
$.ajax( { $.ajax( {
url: RPC._Root, url: RPC._Root,
type: 'POST', type: 'POST',
@ -83,14 +86,15 @@ TransmissionRemote.prototype =
data: $.toJSON(data), data: $.toJSON(data),
beforeSend: function(XHR){ remote.appendSessionId(XHR) }, beforeSend: function(XHR){ remote.appendSessionId(XHR) },
error: function(request, error_string, exception){ remote.ajaxError(request, error_string, exception, this) }, 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 tr = this._controller;
var o = { method: 'session-get' }; var o = { method: 'session-get' };
this.sendRequest( o, callback ); this.sendRequest( o, callback, async );
}, },
getInitialDataFor: function(torrent_ids, callback) { getInitialDataFor: function(torrent_ids, callback) {