-
Notifications
You must be signed in to change notification settings - Fork 9
/
composition.js
65 lines (57 loc) · 1.31 KB
/
composition.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @license MIT http://troopjs.mit-license.org/
*/
define([ "troopjs-compose/factory" ], function (Factory) {
"use strict";
var INSTANCE_COUNTER = 0;
var INSTANCE_COUNT = "instanceCount";
/**
* Base composition with instance count.
* @class core.composition
* @implement compose.composition
*/
/**
* Instance counter
* @private
* @readonly
* @property {Number} instanceCount
*/
/**
* @method create
* @static
* @inheritable
* @inheritdoc
* @return {Object} Instance of this class
*/
/**
* @method extend
* @static
* @inheritable
* @inheritdoc
* @return {core.composition} The extended subclass
*/
/**
* Creates a new component instance
* @method constructor
*/
return Factory(function () {
this[INSTANCE_COUNT] = ++INSTANCE_COUNTER;
}, {
/**
* The hierarchical namespace for this component that indicates it's functionality.
* @protected
* @readonly
* @property {String}
*/
"displayName": "core/composition",
/**
* Gives string representation of this component instance.
* @return {String} {@link #displayName}`@`{@link #instanceCount}
* @protected
*/
"toString": function () {
var me = this;
return me.displayName + "@" + me[INSTANCE_COUNT];
}
});
});