@@ -115,17 +115,24 @@ Phaser.Loader = function (game) {
115115 this . useXDomainRequest = false ;
116116
117117 /**
118- * The number of concurrent assets to try and fetch at once - must be at least 1.
118+ * If true then parallel downloading will be enabled.
119+ *
120+ * @property {integer } enableParallelDownloads
121+ */
122+ this . enableParallelDownloads = true ;
123+
124+ /**
125+ * The number of concurrent assets to try and fetch at once.
119126 * Most browsers limit 6 requests per host.
120127 *
121- * @property {integer } concurrentRequestCount
128+ * @property {integer } maxParallelDownloads
122129 * @protected
123130 */
124- this . concurrentRequestCount = 6 ;
131+ this . maxParallelDownloads = 5 ;
125132
126133 /**
127134 * Contains all the information for asset files (including packs) to load.
128- *
135+ *
129136 * @property {array } _fileList
130137 * @private
131138 */
@@ -1056,7 +1063,9 @@ Phaser.Loader.prototype = {
10561063
10571064 // When true further non-pack file downloads are suppressed
10581065 var syncblock = false ;
1059- var inflightLimit = Phaser . Math . clamp ( this . concurrentRequestCount , 1 , 10 ) ;
1066+
1067+ var inflightLimit = Phaser . Math . clamp (
1068+ this . maxParallelDownloads , 1 , this . enableParallelDownloads ? 12 : 1 ) ;
10601069
10611070 for ( var i = this . _processingHead ; i < this . _fileList . length ; i ++ )
10621071 {
@@ -1085,7 +1094,7 @@ Phaser.Loader.prototype = {
10851094 }
10861095 else if ( ! file . loading && this . _flightQueue . length < inflightLimit )
10871096 {
1088- // -> !file. loaded
1097+ // -> not loaded, not loading
10891098 if ( file . type === 'packfile' && ! file . data )
10901099 {
10911100 // Fetches the pack data: the pack is processed above as it reaches queue-start.
@@ -1118,7 +1127,7 @@ Phaser.Loader.prototype = {
11181127
11191128 // Stop looking if queue full - or if syncblocked and there are no more packs.
11201129 // (As only packs can be loaded around a syncblock)
1121- if ( this . _flightQueue . length == = inflightLimit ||
1130+ if ( this . _flightQueue . length > = inflightLimit ||
11221131 ( syncblock && this . _loadedPackCount === this . _totalPackCount ) )
11231132 {
11241133 break ;
0 commit comments