@@ -57,7 +57,7 @@ this.createjs = this.createjs || {};
5757 * @type String
5858 * @static
5959 **/
60- s . buildDate = /*=date*/ "Wed, 21 Jun 2017 16:53:32 GMT" ; // injected by build process
60+ s . buildDate = /*=date*/ "Thu, 14 Sep 2017 22:19:45 GMT" ; // injected by build process
6161
6262} ) ( ) ;
6363
@@ -157,6 +157,48 @@ createjs.promote = function(subclass, prefix) {
157157 return subclass ;
158158} ;
159159
160+ //##############################################################################
161+ // deprecate.js
162+ //##############################################################################
163+
164+ this . createjs = this . createjs || { } ;
165+
166+ /**
167+ * @class Utility Methods
168+ */
169+
170+ /**
171+ * Wraps deprecated methods so they still be used, but throw warnings to developers.
172+ *
173+ * obj.deprecatedMethod = createjs.deprecate("Old Method Name", obj._fallbackMethod);
174+ *
175+ * The recommended approach for deprecated properties is:
176+ *
177+ * try {
178+ * Obj ect.defineProperties(object, {
179+ * readyOnlyProp: { get: createjs.deprecate("readOnlyProp", function() { return this.alternateProp; }) },
180+ * readWriteProp: {
181+ * get: createjs.deprecate("readOnlyProp", function() { return this.alternateProp; }),
182+ * set: createjs.deprecate("readOnlyProp", function(val) { this.alternateProp = val; })
183+ * });
184+ * } catch (e) {}
185+ *
186+ * @method deprecate
187+ * @param {Function} [fallbackMethod=null] A method to call when the deprecated method is used. See the example for how
188+ * @param {String} [name=null] The name of the method or property to display in the console warning.
189+ * to deprecate properties.
190+ * @return {Function } If a fallbackMethod is supplied, returns a closure that will call the fallback method after
191+ * logging the warning in the console.
192+ */
193+ createjs . deprecate = function ( fallbackMethod , name ) {
194+ "use strict" ;
195+ return function ( ) {
196+ var msg = "Deprecated property or method '" + name + "'. See docs for info." ;
197+ console && ( console . warn ? console . warn ( msg ) : console . log ( msg ) ) ;
198+ return fallbackMethod && fallbackMethod . apply ( this , arguments ) ;
199+ }
200+ } ;
201+
160202//##############################################################################
161203// indexOf.js
162204//##############################################################################
@@ -2029,6 +2071,30 @@ this.createjs = this.createjs || {};
20292071 var p = createjs . extend ( AbstractLoader , createjs . EventDispatcher ) ;
20302072 var s = AbstractLoader ;
20312073
2074+ // Remove these @deprecated properties after 1.0
2075+ try {
2076+ Object . defineProperties ( s , {
2077+ POST : { get : createjs . deprecate ( function ( ) { return createjs . Methods . POST ; } , "AbstractLoader.POST" ) } ,
2078+ GET : { get : createjs . deprecate ( function ( ) { return createjs . Methods . GET ; } , "AbstractLoader.GET" ) } ,
2079+
2080+ BINARY : { get : createjs . deprecate ( function ( ) { return createjs . Types . BINARY ; } , "AbstractLoader.BINARY" ) } ,
2081+ CSS : { get : createjs . deprecate ( function ( ) { return createjs . Types . CSS ; } , "AbstractLoader.CSS" ) } ,
2082+ FONT : { get : createjs . deprecate ( function ( ) { return createjs . Types . FONT ; } , "AbstractLoader.FONT" ) } ,
2083+ FONTCSS : { get : createjs . deprecate ( function ( ) { return createjs . Types . FONTCSS ; } , "AbstractLoader.FONTCSS" ) } ,
2084+ IMAGE : { get : createjs . deprecate ( function ( ) { return createjs . Types . IMAGE ; } , "AbstractLoader.IMAGE" ) } ,
2085+ JAVASCRIPT : { get : createjs . deprecate ( function ( ) { return createjs . Types . JAVASCRIPT ; } , "AbstractLoader.JAVASCRIPT" ) } ,
2086+ JSON : { get : createjs . deprecate ( function ( ) { return createjs . Types . JSON ; } , "AbstractLoader.JSON" ) } ,
2087+ JSONP : { get : createjs . deprecate ( function ( ) { return createjs . Types . JSONP ; } , "AbstractLoader.JSONP" ) } ,
2088+ MANIFEST : { get : createjs . deprecate ( function ( ) { return createjs . Types . MANIFEST ; } , "AbstractLoader.MANIFEST" ) } ,
2089+ SOUND : { get : createjs . deprecate ( function ( ) { return createjs . Types . SOUND ; } , "AbstractLoader.SOUND" ) } ,
2090+ VIDEO : { get : createjs . deprecate ( function ( ) { return createjs . Types . VIDEO ; } , "AbstractLoader.VIDEO" ) } ,
2091+ SPRITESHEET : { get : createjs . deprecate ( function ( ) { return createjs . Types . SPRITESHEET ; } , "AbstractLoader.SPRITESHEET" ) } ,
2092+ SVG : { get : createjs . deprecate ( function ( ) { return createjs . Types . SVG ; } , "AbstractLoader.SVG" ) } ,
2093+ TEXT : { get : createjs . deprecate ( function ( ) { return createjs . Types . TEXT ; } , "AbstractLoader.TEXT" ) } ,
2094+ XML : { get : createjs . deprecate ( function ( ) { return createjs . Types . XML ; } , "AbstractLoader.XML" ) }
2095+ } ) ;
2096+ } catch ( e ) { }
2097+
20322098// Events
20332099 /**
20342100 * The {{#crossLink "ProgressEvent"}}{{/crossLink}} that is fired when the overall progress changes. Prior to
@@ -3629,10 +3695,12 @@ this.createjs = this.createjs || {};
36293695 * @static
36303696 */
36313697 s . create = function ( value ) {
3632- if ( value == null || value instanceof s || value instanceof Object ) {
3633- var ppc = new createjs . PlayPropsConfig ( ) ;
3634- ppc . set ( value ) ;
3635- return ppc ;
3698+ if ( typeof ( value ) === "string" ) {
3699+ // Handle the old API gracefully.
3700+ console && ( console . warn || console . log ) ( "Deprecated behaviour. Sound.play takes a configuration object instead of individual arguments. See docs for info." ) ;
3701+ return new createjs . PlayPropsConfig ( ) . set ( { interrupt :value } ) ;
3702+ } else if ( value == null || value instanceof s || value instanceof Object ) {
3703+ return new createjs . PlayPropsConfig ( ) . set ( value ) ;
36363704 } else if ( value == null ) {
36373705 throw new Error ( "PlayProps configuration not recognized." ) ;
36383706 }
@@ -4039,36 +4107,63 @@ this.createjs = this.createjs || {};
40394107
40404108
40414109// class getter / setter properties
4110+
40424111 /**
40434112 * Set the master volume of Sound. The master volume is multiplied against each sound's individual volume. For
40444113 * example, if master volume is 0.5 and a sound's volume is 0.5, the resulting volume is 0.25. To set individual
4045- * sound volume, use AbstractSoundInstance {{#crossLink "AbstractSoundInstance/volume:property"}}{{/crossLink}} instead.
4114+ * sound volume, use AbstractSoundInstance {{#crossLink "AbstractSoundInstance/volume:property"}}{{/crossLink}}
4115+ * instead.
40464116 *
40474117 * <h4>Example</h4>
40484118 *
40494119 * createjs.Sound.volume = 0.5;
40504120 *
4051- *
40524121 * @property volume
40534122 * @type {Number }
40544123 * @default 1
40554124 * @since 0.6.1
40564125 */
4126+
4127+ /**
4128+ * The internal volume level. Use {{#crossLink "Sound/volume:property"}}{{/crossLink}} to adjust the master volume.
4129+ * @property _masterVolume
4130+ * @type {number }
4131+ * @default 1
4132+ * @private
4133+ */
40574134 s . _masterVolume = 1 ;
4058- Object . defineProperty ( s , "volume" , {
4059- get : function ( ) { return this . _masterVolume ; } ,
4060- set : function ( value ) {
4061- if ( Number ( value ) == null ) { return false ; }
4062- value = Math . max ( 0 , Math . min ( 1 , value ) ) ;
4063- s . _masterVolume = value ;
4064- if ( ! this . activePlugin || ! this . activePlugin . setVolume || ! this . activePlugin . setVolume ( value ) ) {
4065- var instances = this . _instances ;
4066- for ( var i = 0 , l = instances . length ; i < l ; i ++ ) {
4067- instances [ i ] . setMasterVolume ( value ) ;
4068- }
4069- }
4135+
4136+ /**
4137+ * Use the {{#crossLink "Sound/volume:property"}}{{/crossLink}} property instead.
4138+ * @method _getMasterVolume
4139+ * @private
4140+ * @static
4141+ * @return {Number }
4142+ **/
4143+ s . _getMasterVolume = function ( ) {
4144+ return this . _masterVolume ;
4145+ } ;
4146+ // Sound.getMasterVolume is @deprecated . Remove for 1.1+
4147+ s . getVolume = createjs . deprecate ( s . _getMasterVolume , "Sound.getVolume" ) ;
4148+ /**
4149+ * Use the {{#crossLink "Sound/volume:property"}}{{/crossLink}} property instead.
4150+ * @method _setMasterVolume
4151+ * @static
4152+ * @private
4153+ **/
4154+ s . _setMasterVolume = function ( value ) {
4155+ if ( Number ( value ) == null ) { return ; }
4156+ value = Math . max ( 0 , Math . min ( 1 , value ) ) ;
4157+ s . _masterVolume = value ;
4158+ if ( ! this . activePlugin || ! this . activePlugin . setVolume || ! this . activePlugin . setVolume ( value ) ) {
4159+ var instances = this . _instances ;
4160+ for ( var i = 0 , l = instances . length ; i < l ; i ++ ) {
4161+ instances [ i ] . setMasterVolume ( value ) ;
40704162 }
4071- } ) ;
4163+ }
4164+ } ;
4165+ // Sound.stMasterVolume is @deprecated . Remove for 1.1+
4166+ s . setVolume = createjs . deprecate ( s . _setMasterVolume , "Sound.setVolume" ) ;
40724167
40734168 /**
40744169 * Mute/Unmute all audio. Note that muted audio still plays at 0 volume. This global mute value is maintained
@@ -4086,22 +4181,39 @@ this.createjs = this.createjs || {};
40864181 * @since 0.6.1
40874182 */
40884183 s . _masterMute = false ;
4089- // OJR references to the methods were not working, so the code had to be duplicated here
4090- Object . defineProperty ( s , "muted" , {
4091- get : function ( ) { return this . _masterMute ; } ,
4092- set : function ( value ) {
4093- if ( value == null ) { return false ; }
4094-
4095- this . _masterMute = value ;
4096- if ( ! this . activePlugin || ! this . activePlugin . setMute || ! this . activePlugin . setMute ( value ) ) {
4097- var instances = this . _instances ;
4098- for ( var i = 0 , l = instances . length ; i < l ; i ++ ) {
4099- instances [ i ] . setMasterMute ( value ) ;
4100- }
4101- }
4102- return true ;
4184+
4185+ /**
4186+ * Use the {{#crossLink "Sound/muted:property"}}{{/crossLink}} property instead.
4187+ * @method _getMute
4188+ * @returns {Boolean }
4189+ * @static
4190+ * @private
4191+ */
4192+ s . _getMute = function ( ) {
4193+ return this . _masterMute ;
4194+ } ;
4195+ // Sound.getMute is @deprecated . Remove for 1.1+
4196+ s . getMute = createjs . deprecate ( s . _getMute , "Sound.getMute" ) ;
4197+
4198+ /**
4199+ * Use the {{#crossLink "Sound/muted:property"}}{{/crossLink}} property instead.
4200+ * @method _setMute
4201+ * @param {Boolean } value The muted value
4202+ * @static
4203+ * @private
4204+ */
4205+ s . _setMute = function ( value ) {
4206+ if ( value == null ) { return ; }
4207+ this . _masterMute = value ;
4208+ if ( ! this . activePlugin || ! this . activePlugin . setMute || ! this . activePlugin . setMute ( value ) ) {
4209+ var instances = this . _instances ;
4210+ for ( var i = 0 , l = instances . length ; i < l ; i ++ ) {
4211+ instances [ i ] . setMasterMute ( value ) ;
41034212 }
4104- } ) ;
4213+ }
4214+ } ;
4215+ // Sound.setMute is @deprecated . Remove for 1.1+
4216+ s . setMute = createjs . deprecate ( s . _setMute , "Sound.setMute" ) ;
41054217
41064218 /**
41074219 * Get the active plugins capabilities, which help determine if a plugin can be used in the current environment,
@@ -4137,12 +4249,23 @@ this.createjs = this.createjs || {};
41374249 * @readOnly
41384250 * @since 0.6.1
41394251 */
4140- Object . defineProperty ( s , "capabilities" , {
4141- get : function ( ) {
4142- if ( s . activePlugin == null ) { return null ; }
4143- return s . activePlugin . _capabilities ;
4144- } ,
4145- set : function ( value ) { return false ; }
4252+
4253+ /**
4254+ * Use the {{#crossLink "Sound/capabilities:property"}}{{/crossLink}} property instead.
4255+ * @returns {null }
4256+ * @private
4257+ */
4258+ s . _getCapabilities = function ( ) {
4259+ if ( s . activePlugin == null ) { return null ; }
4260+ return s . activePlugin . _capabilities ;
4261+ } ;
4262+ // Sound.getCapabilities is @deprecated . Remove for 1.1+
4263+ s . getCapabilities = createjs . deprecate ( s . _getCapabilities , "Sound.getCapabilities" ) ;
4264+
4265+ Object . defineProperties ( s , {
4266+ volume : { get : s . _getMasterVolume , set : s . _setMasterVolume } ,
4267+ muted : { get : s . _getMute , set : s . _setMute } ,
4268+ capabilities : { get : s . _getCapabilities }
41464269 } ) ;
41474270
41484271
@@ -7158,8 +7281,9 @@ this.createjs = this.createjs || {};
71587281 s . _createAudioContext = function ( ) {
71597282 // Slightly modified version of https://github.com/Jam3/ios-safe-audio-context
71607283 // Resolves issues with first-run contexts playing garbled on iOS.
7161- var AudioCtor = ( window . AudioContext || window . webkitAudioContext ) ,
7162- context = new AudioCtor ( ) ;
7284+ var AudioCtor = ( window . AudioContext || window . webkitAudioContext ) ;
7285+ if ( AudioCtor == null ) { return null ; }
7286+ var context = new AudioCtor ( ) ;
71637287
71647288 // Check if hack is necessary. Only occurs in iOS6+ devices
71657289 // and only when you first boot the iPhone, or play a audio/video
0 commit comments