@@ -123,6 +123,48 @@ createjs.promote = function(subclass, prefix) {
123123 return subclass ;
124124} ;
125125
126+ //##############################################################################
127+ // deprecate.js
128+ //##############################################################################
129+
130+ this . createjs = this . createjs || { } ;
131+
132+ /**
133+ * @class Utility Methods
134+ */
135+
136+ /**
137+ * Wraps deprecated methods so they still be used, but throw warnings to developers.
138+ *
139+ * obj.deprecatedMethod = createjs.deprecate("Old Method Name", obj._fallbackMethod);
140+ *
141+ * The recommended approach for deprecated properties is:
142+ *
143+ * try {
144+ * Obj ect.defineProperties(object, {
145+ * readyOnlyProp: { get: createjs.deprecate("readOnlyProp", function() { return this.alternateProp; }) },
146+ * readWriteProp: {
147+ * get: createjs.deprecate("readOnlyProp", function() { return this.alternateProp; }),
148+ * set: createjs.deprecate("readOnlyProp", function(val) { this.alternateProp = val; })
149+ * });
150+ * } catch (e) {}
151+ *
152+ * @method deprecate
153+ * @param {Function} [fallbackMethod=null] A method to call when the deprecated method is used. See the example for how
154+ * @param {String} [name=null] The name of the method or property to display in the console warning.
155+ * to deprecate properties.
156+ * @return {Function } If a fallbackMethod is supplied, returns a closure that will call the fallback method after
157+ * logging the warning in the console.
158+ */
159+ createjs . deprecate = function ( fallbackMethod , name ) {
160+ "use strict" ;
161+ return function ( ) {
162+ var msg = "Deprecated property or method '" + name + "'. See docs for info." ;
163+ console && ( console . warn ? console . warn ( msg ) : console . log ( msg ) ) ;
164+ return fallbackMethod && fallbackMethod . apply ( this , arguments ) ;
165+ }
166+ } ;
167+
126168//##############################################################################
127169// Event.js
128170//##############################################################################
@@ -834,8 +876,8 @@ this.createjs = this.createjs||{};
834876// public static properties:
835877 /**
836878 * Specifies the timing api (setTimeout or requestAnimationFrame) and mode to use. See
837- * {{#crossLink "Ticker/TIMEOUT"}}{{/crossLink}}, {{#crossLink "Ticker/RAF"}}{{/crossLink}}, and
838- * {{#crossLink "Ticker/RAF_SYNCHED"}}{{/crossLink}} for mode details.
879+ * {{#crossLink "Ticker/TIMEOUT:property "}}{{/crossLink}}, {{#crossLink "Ticker/RAF:property "}}{{/crossLink}}, and
880+ * {{#crossLink "Ticker/RAF_SYNCHED:property "}}{{/crossLink}} for mode details.
839881 * @property timingMode
840882 * @static
841883 * @type {String }
@@ -1007,6 +1049,8 @@ this.createjs = this.createjs||{};
10071049 if ( ! Ticker . _inited ) { return ; }
10081050 Ticker . _setupTick ( ) ;
10091051 } ;
1052+ // Ticker.setInterval is @deprecated . Remove for 1.1+
1053+ Ticker . setInterval = createjs . deprecate ( Ticker . _setInterval , "Ticker.setInterval" ) ;
10101054
10111055 /**
10121056 * Use the {{#crossLink "Ticker/interval:property"}}{{/crossLink}} property instead.
@@ -1018,6 +1062,8 @@ this.createjs = this.createjs||{};
10181062 Ticker . _getInterval = function ( ) {
10191063 return Ticker . _interval ;
10201064 } ;
1065+ // Ticker.getInterval is @deprecated . Remove for 1.1+
1066+ Ticker . getInterval = createjs . deprecate ( Ticker . _getInterval , "Ticker.getInterval" ) ;
10211067
10221068 /**
10231069 * Use the {{#crossLink "Ticker/framerate:property"}}{{/crossLink}} property instead.
@@ -1029,6 +1075,8 @@ this.createjs = this.createjs||{};
10291075 Ticker . _setFPS = function ( value ) {
10301076 Ticker . _setInterval ( 1000 / value ) ;
10311077 } ;
1078+ // Ticker.setFPS is @deprecated . Remove for 1.1+
1079+ Ticker . setFPS = createjs . deprecate ( Ticker . _setFPS , "Ticker.setFPS" ) ;
10321080
10331081 /**
10341082 * Use the {{#crossLink "Ticker/framerate:property"}}{{/crossLink}} property instead.
@@ -1040,6 +1088,8 @@ this.createjs = this.createjs||{};
10401088 Ticker . _getFPS = function ( ) {
10411089 return 1000 / Ticker . _interval ;
10421090 } ;
1091+ // Ticker.getFPS is @deprecated . Remove for 1.1+
1092+ Ticker . getFPS = createjs . deprecate ( Ticker . _getFPS , "Ticker.getFPS" ) ;
10431093
10441094 /**
10451095 * Indicates the target time (in milliseconds) between ticks. Default is 50 (20 FPS).
@@ -1494,39 +1544,42 @@ this.createjs = this.createjs||{};
14941544// getter / setters:
14951545
14961546 /**
1497- * Deprecated in favor of the {{#crossLink "AbstractTween/paused:property"}}{{/crossLink}} property.
1498- * @method setPaused
1547+ * Use the {{#crossLink "AbstractTween/paused:property"}}{{/crossLink}} property instead .
1548+ * @method _setPaused
14991549 * @param {Boolean } [value=true] Indicates whether the tween should be paused (`true`) or played (`false`).
1500- * @deprecated
15011550 * @return {AbstractTween } This tween instance (for chaining calls)
1551+ * @protected
15021552 * @chainable
15031553 */
1504- p . setPaused = function ( value ) {
1554+ p . _setPaused = function ( value ) {
15051555 createjs . Tween . _register ( this , value ) ;
15061556 return this ;
15071557 } ;
1558+ p . setPaused = createjs . deprecate ( p . _setPaused , "AbstractTween.setPaused" ) ;
15081559
15091560 /**
1510- * Deprecated in favor of the {{#crossLink "AbstractTween/paused:property"}}{{/crossLink}} property.
1511- * @method getPaused
1512- * @deprecated
1561+ * Use the {{#crossLink "AbstractTween/paused:property"}}{{/crossLink}} property instead .
1562+ * @method _getPaused
1563+ * @protected
15131564 */
1514- p . getPaused = function ( ) {
1565+ p . _getPaused = function ( ) {
15151566 return this . _paused ;
15161567 } ;
1568+ p . getPaused = createjs . deprecate ( p . _getPaused , "AbstactTween.getPaused" ) ;
15171569
15181570 /**
1519- * Deprecated in favor of the {{#crossLink "AbstractTween/currentLabel:property"}}{{/crossLink}} property.
1520- * @method getCurrentLabel
1521- * @deprecated
1571+ * Use the {{#crossLink "AbstractTween/currentLabel:property"}}{{/crossLink}} property instead .
1572+ * @method _getCurrentLabel
1573+ * @protected
15221574 * @return {String } The name of the current label or null if there is no label
15231575 **/
1524- p . getCurrentLabel = function ( pos ) {
1576+ p . _getCurrentLabel = function ( pos ) {
15251577 var labels = this . getLabels ( ) ;
15261578 if ( pos == null ) { pos = this . position ; }
15271579 for ( var i = 0 , l = labels . length ; i < l ; i ++ ) { if ( pos < labels [ i ] . position ) { break ; } }
15281580 return ( i === 0 ) ? null : labels [ i - 1 ] . label ;
15291581 } ;
1582+ p . getCurrentLabel = createjs . deprecate ( p . _getCurrentLabel , "AbstractTween.getCurrentLabel" ) ;
15301583
15311584 /**
15321585 * Pauses or unpauses the tween. A paused tween is removed from the global registry and is eligible for garbage
@@ -1552,8 +1605,8 @@ this.createjs = this.createjs||{};
15521605
15531606 try {
15541607 Object . defineProperties ( p , {
1555- paused : { set : p . setPaused , get : p . getPaused } ,
1556- currentLabel : { get : p . getCurrentLabel }
1608+ paused : { set : p . _setPaused , get : p . _getPaused } ,
1609+ currentLabel : { get : p . _getCurrentLabel }
15571610 } ) ;
15581611 } catch ( e ) { }
15591612
@@ -3775,6 +3828,6 @@ this.createjs = this.createjs || {};
37753828 * @type String
37763829 * @static
37773830 **/
3778- s . buildDate = /*=date*/ "Wed, 21 Jun 2017 16:57:37 GMT" ; // injected by build process
3831+ s . buildDate = /*=date*/ "Thu, 14 Sep 2017 22:19:45 GMT" ; // injected by build process
37793832
37803833} ) ( ) ;
0 commit comments