Skip to content

Commit d8227cd

Browse files
committed
Loader - documentation
Additional documentation updates.
1 parent 1062b73 commit d8227cd

1 file changed

Lines changed: 27 additions & 11 deletions

File tree

src/loader/Loader.js

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,49 @@
99
* The Loader handles loading all external content such as Images, Sounds, Texture Atlases and data files.
1010
* It uses a combination of tag loading (eg. Image elements) and XHR and provides progress and completion callbacks.
1111
*
12+
* Parallel loading is supported but must be enabled explicitly with {@link Phaser.Loader#enableParallelDownloads enableParallelDownloads}.
13+
* Load-before behavior of parallel resources is controlled by synchronization points as discussed in {@link Phaser.Loader#withSyncPoint withSyncPoint}.
14+
*
1215
* @class Phaser.Loader
1316
* @constructor
1417
* @param {Phaser.Game} game - A reference to the currently running game.
1518
*/
1619
Phaser.Loader = function (game) {
1720

1821
/**
19-
* @property {Phaser.Game} game - Local reference to game.
22+
* Local reference to game.
23+
* @property {Phaser.Game} game
24+
* @protected
2025
*/
2126
this.game = game;
2227

2328
/**
24-
* @property {boolean} isLoading - True if the Loader is in the process of loading the queue.
29+
* True if the Loader is in the process of loading the queue.
30+
* @property {boolean} isLoading
2531
* @default
2632
*/
2733
this.isLoading = false;
2834

2935
/**
30-
* @property {boolean} hasLoaded - True if all assets in the queue have finished loading.
36+
* True if all assets in the queue have finished loading.
37+
* @property {boolean} hasLoaded
3138
* @default
3239
*/
3340
this.hasLoaded = false;
3441

3542
/**
36-
* You can optionally link a sprite to the preloader.
43+
* You can optionally link a progress sprite with {@link Phaser.Loader#setPreloadSprite setPreloadSprite}.
3744
*
38-
* The Sprites width or height will be cropped based on the percentage loaded.
3945
* This property is an object containing: sprite, rect, direction, width and height
4046
*
4147
* @property {?object} preloadSprite
48+
* @protected
4249
*/
4350
this.preloadSprite = null;
4451

4552
/**
46-
* @property {boolean|string} crossOrigin - The crossOrigin value applied to loaded images. Very often this needs to be set to 'anonymous'.
53+
* The crossOrigin value applied to loaded images. Very often this needs to be set to 'anonymous'.
54+
* @property {boolean|string} crossOrigin
4755
* @default
4856
*/
4957
this.crossOrigin = false;
@@ -111,7 +119,9 @@ Phaser.Loader = function (game) {
111119
this.onFileError = new Phaser.Signal();
112120

113121
/**
114-
* @property {boolean} useXDomainRequest - If true and if the browser supports XDomainRequest, it will be used in preference for XHR when loading JSON files (it does not affect other file types). This is only relevant for IE9 and should only be enabled when you know your server/CDN requires it.
122+
* If true and if the browser supports XDomainRequest, it will be used in preference for XHR when loading JSON files (it does not affect other file types).
123+
* This is only relevant for IE9 and should only be enabled when required by the server/CDN.
124+
* @property {boolean} useXDomainRequest
115125
*/
116126
this.useXDomainRequest = false;
117127

@@ -124,22 +134,24 @@ Phaser.Loader = function (game) {
124134

125135
/**
126136
* The number of concurrent assets to try and fetch at once.
127-
* Most browsers limit 6 requests per host.
137+
* Most browsers limit 6 requests per domain.
128138
*
129139
* @property {integer} maxParallelDownloads
130140
* @protected
131141
*/
132142
this.maxParallelDownloads = 5;
133143

134144
/**
135-
* A counter: if more than zero files will be automatically added as a synchronization point.
145+
* A counter: if more than zero, files will be automatically added as a synchronization point.
136146
* @property {integer} _withSyncPointDepth;
137147
*/
138148
this._withSyncPointDepth = 0;
139149

140150
/**
141151
* Contains all the information for asset files (including packs) to load.
142152
*
153+
* File/assets are only removed from the list after all loading completes.
154+
*
143155
* @property {array} _fileList
144156
* @private
145157
*/
@@ -1027,7 +1039,7 @@ Phaser.Loader.prototype = {
10271039
/**
10281040
* Remove a file/asset from the loading queue.
10291041
*
1030-
* A file that has already started loading cannot be removed.
1042+
* A file that is loaded or has started loading cannot be removed.
10311043
*
10321044
* @method Phaser.Loader#removeFile
10331045
* @protected
@@ -1088,7 +1100,7 @@ Phaser.Loader.prototype = {
10881100
*
10891101
* If a sync-file is encountered then subsequent asset processing is delayed until it completes.
10901102
* The exception to this rule is that packfiles can be downloaded (but not processed) even if
1091-
* there appear other sync files (ie. packs) - this enables multiple packfiles to be fetched asynchronously,
1103+
* there appear other sync files (ie. packs) - this enables multiple packfiles to be fetched in parallel.
10921104
* such as during the start phaser.
10931105
*
10941106
* @method Phaser.Loader#processLoadQueue
@@ -2050,6 +2062,7 @@ Phaser.Loader.prototype = {
20502062
* Returns the number of files that have already been loaded, even if they errored.
20512063
*
20522064
* @method Phaser.Loader#totalLoadedFiles
2065+
* @protected
20532066
* @return {number} The number of files that have already been loaded (even if they errored)
20542067
*/
20552068
totalLoadedFiles: function () {
@@ -2062,6 +2075,7 @@ Phaser.Loader.prototype = {
20622075
* Returns the number of files still waiting to be processed in the load queue. This value decreases as each file in the queue is loaded.
20632076
*
20642077
* @method Phaser.Loader#totalQueuedFiles
2078+
* @protected
20652079
* @return {number} The number of files that still remain in the load queue.
20662080
*/
20672081
totalQueuedFiles: function () {
@@ -2074,6 +2088,7 @@ Phaser.Loader.prototype = {
20742088
* Returns the number of asset packs that have already been loaded, even if they errored.
20752089
*
20762090
* @method Phaser.Loader#totalLoadedPacks
2091+
* @protected
20772092
* @return {number} The number of asset packs that have already been loaded (even if they errored)
20782093
*/
20792094
totalLoadedPacks: function () {
@@ -2086,6 +2101,7 @@ Phaser.Loader.prototype = {
20862101
* Returns the number of asset packs still waiting to be processed in the load queue. This value decreases as each pack in the queue is loaded.
20872102
*
20882103
* @method Phaser.Loader#totalQueuedPacks
2104+
* @protected
20892105
* @return {number} The number of asset packs that still remain in the load queue.
20902106
*/
20912107
totalQueuedPacks: function () {

0 commit comments

Comments
 (0)