Skip to content

Commit c393d16

Browse files
committed
Updated shared classes from PreloadJS
1 parent 472260d commit c393d16

5 files changed

Lines changed: 29 additions & 225 deletions

File tree

src/preloadjs/data/LoadItem.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ this.createjs = this.createjs || {};
104104
this.data = null;
105105

106106
/**
107-
* The request method used for HTTP calls. Both {{#crossLink "AbstractLoader/GET:property"}}{{/crossLink}} or
108-
* {{#crossLink "AbstractLoader/POST:property"}}{{/crossLink}} request types are supported, and are defined as
107+
* The request method used for HTTP calls. Both {{#crossLink "Methods/GET:property"}}{{/crossLink}} or
108+
* {{#crossLink "Methods/POST:property"}}{{/crossLink}} request types are supported, and are defined as
109109
* constants on {{#crossLink "AbstractLoader"}}{{/crossLink}}.
110110
* @property method
111111
* @type {String}
112112
* @default GET
113113
*/
114-
this.method = createjs.LoadItem.GET;
114+
this.method = createjs.Methods.GET;
115115

116116
/**
117117
* An object hash of name/value pairs to send to the server.

src/preloadjs/loaders/AbstractLoader.js

Lines changed: 0 additions & 196 deletions
Original file line numberDiff line numberDiff line change
@@ -194,192 +194,6 @@ this.createjs = this.createjs || {};
194194
var p = createjs.extend(AbstractLoader, createjs.EventDispatcher);
195195
var s = AbstractLoader;
196196

197-
198-
/**
199-
* Defines a POST request, use for a method value when loading data.
200-
* @property POST
201-
* @type {string}
202-
* @default post
203-
* @deprecated Use Methods.POST instead
204-
* @static
205-
*/
206-
s.POST = createjs.Methods.POST;
207-
208-
/**
209-
* Defines a GET request, use for a method value when loading data.
210-
* @property GET
211-
* @type {string}
212-
* @default get
213-
* @deprecated Use Methods.GET instead
214-
* @static
215-
*/
216-
s.GET = createjs.Methods.GET;
217-
218-
/**
219-
* The preload type for generic binary types. Note that images are loaded as binary files when using XHR.
220-
* @property BINARY
221-
* @type {String}
222-
* @default binary
223-
* @static
224-
* @deprecated Use createjs.Types.BINARY instead
225-
* @since 0.6.0
226-
*/
227-
s.BINARY = createjs.Types.BINARY;
228-
229-
/**
230-
* The preload type for css files. CSS files are loaded using a <link> when loaded with XHR, or a
231-
* <style> tag when loaded with tags.
232-
* @property CSS
233-
* @type {String}
234-
* @default css
235-
* @static
236-
* @deprecated Use createjs.Types.CSS instead
237-
* @since 0.6.0
238-
*/
239-
s.CSS = createjs.Types.CSS;
240-
241-
s.FONT = createjs.Types.FONT;
242-
s.FONTCSS = createjs.Types.FONTCSS;
243-
244-
/**
245-
* The preload type for image files, usually png, gif, or jpg/jpeg. Images are loaded into an <image> tag.
246-
* @property IMAGE
247-
* @type {String}
248-
* @default image
249-
* @static
250-
* @deprecated Use createjs.Types.IMAGE instead
251-
* @since 0.6.0
252-
*/
253-
s.IMAGE = createjs.Types.IMAGE;
254-
255-
/**
256-
* The preload type for javascript files, usually with the "js" file extension. JavaScript files are loaded into a
257-
* <script> tag.
258-
*
259-
* Since version 0.4.1+, due to how tag-loaded scripts work, all JavaScript files are automatically injected into
260-
* the body of the document to maintain parity between XHR and tag-loaded scripts. In version 0.4.0 and earlier,
261-
* only tag-loaded scripts are injected.
262-
* @property JAVASCRIPT
263-
* @type {String}
264-
* @default javascript
265-
* @static
266-
* @deprecated Use createjs.Types.JAVASCRIPT instead
267-
* @since 0.6.0
268-
*/
269-
s.JAVASCRIPT = createjs.Types.JAVASCRIPT;
270-
271-
/**
272-
* The preload type for json files, usually with the "json" file extension. JSON data is loaded and parsed into a
273-
* JavaScript object. Note that if a `callback` is present on the load item, the file will be loaded with JSONP,
274-
* no matter what the {{#crossLink "LoadQueue/preferXHR:property"}}{{/crossLink}} property is set to, and the JSON
275-
* must contain a matching wrapper function.
276-
* @property JSON
277-
* @type {String}
278-
* @default json
279-
* @static
280-
* @deprecated Use createjs.Types.JSON instead
281-
* @since 0.6.0
282-
*/
283-
s.JSON = createjs.Types.JSON;
284-
285-
/**
286-
* The preload type for jsonp files, usually with the "json" file extension. JSON data is loaded and parsed into a
287-
* JavaScript object. You are required to pass a callback parameter that matches the function wrapper in the JSON.
288-
* Note that JSONP will always be used if there is a callback present, no matter what the {{#crossLink "LoadQueue/preferXHR:property"}}{{/crossLink}}
289-
* property is set to.
290-
* @property JSONP
291-
* @type {String}
292-
* @default jsonp
293-
* @static
294-
* @deprecated Use createjs.Types.JSONP instead
295-
* @since 0.6.0
296-
*/
297-
s.JSONP = createjs.Types.JSONP;
298-
299-
/**
300-
* The preload type for json-based manifest files, usually with the "json" file extension. The JSON data is loaded
301-
* and parsed into a JavaScript object. PreloadJS will then look for a "manifest" property in the JSON, which is an
302-
* Array of files to load, following the same format as the {{#crossLink "LoadQueue/loadManifest"}}{{/crossLink}}
303-
* method. If a "callback" is specified on the manifest object, then it will be loaded using JSONP instead,
304-
* regardless of what the {{#crossLink "LoadQueue/preferXHR:property"}}{{/crossLink}} property is set to.
305-
* @property MANIFEST
306-
* @type {String}
307-
* @default manifest
308-
* @static
309-
* @deprecated Use createjs.Types.MANIFEST instead
310-
* @since 0.6.0
311-
*/
312-
s.MANIFEST = "manifest";
313-
314-
/**
315-
* The preload type for sound files, usually mp3, ogg, or wav. When loading via tags, audio is loaded into an
316-
* <audio> tag.
317-
* @property SOUND
318-
* @type {String}
319-
* @default sound
320-
* @static
321-
* @deprecated Use createjs.Types.SOUND instead
322-
* @since 0.6.0
323-
*/
324-
s.SOUND = createjs.Types.SOUND;
325-
326-
/**
327-
* The preload type for video files, usually mp4, ts, or ogg. When loading via tags, video is loaded into an
328-
* <video> tag.
329-
* @property VIDEO
330-
* @type {String}
331-
* @default video
332-
* @static
333-
* @deprecated Use createjs.Types.VIDEO instead
334-
* @since 0.6.0
335-
*/
336-
s.VIDEO = createjs.Types.VIDEO;
337-
338-
/**
339-
* The preload type for SpriteSheet files. SpriteSheet files are JSON files that contain string image paths.
340-
* @property SPRITESHEET
341-
* @type {String}
342-
* @default spritesheet
343-
* @static
344-
* @deprecated Use createjs.Types.SPRITESHEET instead
345-
* @since 0.6.0
346-
*/
347-
s.SPRITESHEET = createjs.Types.SPRITESHEET;
348-
349-
/**
350-
* The preload type for SVG files.
351-
* @property SVG
352-
* @type {String}
353-
* @default svg
354-
* @static
355-
* @deprecated Use createjs.Types.SVG instead
356-
* @since 0.6.0
357-
*/
358-
s.SVG = createjs.Types.SVG;
359-
360-
/**
361-
* The preload type for text files, which is also the default file type if the type can not be determined. Text is
362-
* loaded as raw text.
363-
* @property TEXT
364-
* @type {String}
365-
* @default text
366-
* @static
367-
* @deprecated Use createjs.Types.TEXT instead
368-
* @since 0.6.0
369-
*/
370-
s.TEXT = createjs.Types.TEXT;
371-
372-
/**
373-
* The preload type for xml files. XML is loaded into an XML document.
374-
* @property XML
375-
* @type {String}
376-
* @default xml
377-
* @static
378-
* @deprecated Use createjs.Types.XML instead
379-
* @since 0.6.0
380-
*/
381-
s.XML = createjs.Types.XML;
382-
383197
// Events
384198
/**
385199
* The {{#crossLink "ProgressEvent"}}{{/crossLink}} that is fired when the overall progress changes. Prior to
@@ -753,16 +567,6 @@ this.createjs = this.createjs || {};
753567
this._sendError(event);
754568
};
755569

756-
/**
757-
* @method buildPath
758-
* @protected
759-
* @deprecated Use the {{#crossLink "URLUtils"}}{{/crossLink}} method {{#crossLink "URLUtils/buildURI"}}{{/crossLink}}
760-
* instead.
761-
*/
762-
p.buildPath = function (src, data) {
763-
return createjs.URLUtils.buildURI(src, data);
764-
};
765-
766570
/**
767571
* @method toString
768572
* @return {String} a string representation of the instance.

src/preloadjs/loaders/SoundLoader.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ this.createjs = this.createjs || {};
5050
* @constructor
5151
*/
5252
function SoundLoader(loadItem, preferXHR) {
53-
this.AbstractMediaLoader_constructor(loadItem, preferXHR, createjs.AbstractLoader.SOUND);
53+
this.AbstractMediaLoader_constructor(loadItem, preferXHR, createjs.Types.SOUND);
5454

5555
// protected properties
5656
if (createjs.DomUtils.isAudioTag(loadItem)) {
@@ -72,14 +72,14 @@ this.createjs = this.createjs || {};
7272
// static methods
7373
/**
7474
* Determines if the loader can load a specific item. This loader can only load items that are of type
75-
* {{#crossLink "AbstractLoader/SOUND:property"}}{{/crossLink}}.
75+
* {{#crossLink "Types/SOUND:property"}}{{/crossLink}}.
7676
* @method canLoadItem
7777
* @param {LoadItem|Object} item The LoadItem that a LoadQueue is trying to load.
7878
* @returns {Boolean} Whether the loader can load the item.
7979
* @static
8080
*/
8181
s.canLoadItem = function (item) {
82-
return item.type == createjs.AbstractLoader.SOUND;
82+
return item.type == createjs.Types.SOUND;
8383
};
8484

8585
// protected methods

src/preloadjs/net/XHRRequest.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,21 +495,21 @@ this.createjs = this.createjs || {};
495495
this._xhrLevel = (typeof req.responseType === "string") ? 2 : 1;
496496

497497
var src = null;
498-
if (item.method == createjs.AbstractLoader.GET) {
498+
if (item.method == createjs.Methods.GET) {
499499
src = createjs.URLUtils.buildURI(item.src, item.values);
500500
} else {
501501
src = item.src;
502502
}
503503

504504
// Open the request. Set cross-domain flags if it is supported (XHR level 1 only)
505-
req.open(item.method || createjs.AbstractLoader.GET, src, true);
505+
req.open(item.method || createjs.Methods.GET, src, true);
506506

507507
if (crossdomain && req instanceof XMLHttpRequest && this._xhrLevel == 1) {
508508
headers["Origin"] = location.origin;
509509
}
510510

511511
// To send data we need to set the Content-type header)
512-
if (item.values && item.method == createjs.AbstractLoader.POST) {
512+
if (item.values && item.method == createjs.Methods.POST) {
513513
headers["Content-Type"] = "application/x-www-form-urlencoded";
514514
}
515515

src/preloadjs/utils/RequestUtils.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
*/
5353
s.isBinary = function (type) {
5454
switch (type) {
55-
case createjs.AbstractLoader.IMAGE:
56-
case createjs.AbstractLoader.BINARY:
55+
case createjs.Types.IMAGE:
56+
case createjs.Types.BINARY:
5757
return true;
5858
default:
5959
return false;
@@ -69,14 +69,14 @@
6969
*/
7070
s.isText = function (type) {
7171
switch (type) {
72-
case createjs.AbstractLoader.TEXT:
73-
case createjs.AbstractLoader.JSON:
74-
case createjs.AbstractLoader.MANIFEST:
75-
case createjs.AbstractLoader.XML:
76-
case createjs.AbstractLoader.CSS:
77-
case createjs.AbstractLoader.SVG:
78-
case createjs.AbstractLoader.JAVASCRIPT:
79-
case createjs.AbstractLoader.SPRITESHEET:
72+
case createjs.Types.TEXT:
73+
case createjs.Types.JSON:
74+
case createjs.Types.MANIFEST:
75+
case createjs.Types.XML:
76+
case createjs.Types.CSS:
77+
case createjs.Types.SVG:
78+
case createjs.Types.JAVASCRIPT:
79+
case createjs.Types.SPRITESHEET:
8080
return true;
8181
default:
8282
return false;
@@ -94,7 +94,7 @@
9494
*/
9595
s.getTypeByExtension = function (extension) {
9696
if (extension == null) {
97-
return createjs.AbstractLoader.TEXT;
97+
return createjs.Types.TEXT;
9898
}
9999

100100
switch (extension.toLowerCase()) {
@@ -104,27 +104,27 @@
104104
case "png":
105105
case "webp":
106106
case "bmp":
107-
return createjs.AbstractLoader.IMAGE;
107+
return createjs.Types.IMAGE;
108108
case "ogg":
109109
case "mp3":
110110
case "webm":
111-
return createjs.AbstractLoader.SOUND;
111+
return createjs.Types.SOUND;
112112
case "mp4":
113113
case "webm":
114114
case "ts":
115-
return createjs.AbstractLoader.VIDEO;
115+
return createjs.Types.VIDEO;
116116
case "json":
117-
return createjs.AbstractLoader.JSON;
117+
return createjs.Types.JSON;
118118
case "xml":
119-
return createjs.AbstractLoader.XML;
119+
return createjs.Types.XML;
120120
case "css":
121-
return createjs.AbstractLoader.CSS;
121+
return createjs.Types.CSS;
122122
case "js":
123-
return createjs.AbstractLoader.JAVASCRIPT;
123+
return createjs.Types.JAVASCRIPT;
124124
case 'svg':
125-
return createjs.AbstractLoader.SVG;
125+
return createjs.Types.SVG;
126126
default:
127-
return createjs.AbstractLoader.TEXT;
127+
return createjs.Types.TEXT;
128128
}
129129
};
130130

0 commit comments

Comments
 (0)