You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* copies of the Software, and to permit persons to whom the
13
+
* Software is furnished to do so, subject to the following
14
+
* conditions:
15
+
*
16
+
* The above copyright notice and this permission notice shall be
17
+
* included in all copies or substantial portions of the Software.
18
+
*
19
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26
+
* OTHER DEALINGS IN THE SOFTWARE.
27
+
*/
28
+
29
+
/**
30
+
* @module CreateJS
31
+
*/
32
+
"use strict";
33
+
34
+
// namespace:
35
+
this.createjs=this.createjs||{};
36
+
37
+
/**
38
+
* @class Utility Methods
39
+
*/
40
+
41
+
/**
42
+
* Promotes any methods on the super class that were overridden, by creating an alias in the format `SuperClassName_methodName`.
43
+
* An alias to the super class's constructor is always added in the format `SuperClassName_constructor`.
44
+
* This allows the subclass to call super class methods without using `function.call`, providing better performance.
45
+
*
46
+
* For example, if `MySubClass` extends `MySuperClass`, and both define a `draw` method, then calling `promote(MySubClass)`
47
+
* would: add a `MySuperClass_constructor` method to MySubClass and promote the `draw` method on MySuperClass to the
48
+
* prototype of MySubClass as `MySuperClass_draw`.
49
+
*
50
+
* This should be called after the class's prototype is fully defined.
51
+
*
52
+
* function ClassA(name) {
53
+
* this.name = name;
54
+
* }
55
+
* ClassA.prototype.greet = function() {
56
+
* return "Hello "+this.name;
57
+
* }
58
+
*
59
+
* function ClassB(name, punctuation) {
60
+
* this.ClassA_constructor(name);
61
+
* this.punctuation = punctuation;
62
+
* }
63
+
* createjs.extend(ClassB, ClassA);
64
+
* ClassB.prototype.greet = function() {
65
+
* return this.ClassA_greet()+this.punctuation;
66
+
* }
67
+
* createjs.promote(ClassB);
68
+
*
69
+
* var foo = new ClassB("World", "!?!");
70
+
* console.log(foo.greet()); // Hello World!?!
71
+
*
72
+
* @method extends
73
+
* @param {Function} subclass The subclass to promote super class methods on.
74
+
* @param {String} [superclassName] The name of the superclass. This is only necessary if the constructor is an anonymous function (`MyClass = function()` instead of `function MyClass()`).
0 commit comments