This repository was archived by the owner on Dec 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathObjectManager.ts
More file actions
86 lines (80 loc) · 2.33 KB
/
Copy pathObjectManager.ts
File metadata and controls
86 lines (80 loc) · 2.33 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
///<reference path='./BaseObject.ts'/>
/**
* The {{#crossLink "ObjectManager"}}{{/crossLink}} class is an abstract class that provides enabling and disabling functionality for most StructureJS classes.
*
* @class ObjectManager
* @module StructureJS
* @extends BaseObject
* @submodule core
* @constructor
* @author Robert S. (www.codeBelt.com)
*/
module StructureTS
{
export class ObjectManager extends BaseObject
{
/**
* The isEnabled property is used to keep track of the enabled state of the object.
*
* @property isEnabled
* @type {boolean}
* @default false
* @protected
*/
public isEnabled:boolean = false;
constructor()
{
super();
}
/**
* The enable method is responsible for enabling event listeners and/or children of the containing objects.
*
* @method enable
* @public
* @chainable
* @example
* ClassName.prototype.enable = function() {
* if (this.isEnabled === true) { return this; }
*
* this._childInstance.addEventListener(BaseEvent.CHANGE, this.handlerMethod, this);
* this._childInstance.enable();
*
* return _super.prototype.enable.call(this);
* }
*/
public enable():any
{
if (this.isEnabled === true)
{
return this;
}
this.isEnabled = true;
return this;
}
/**
* The disable method is responsible for disabling event listeners and/or children of the containing objects.
*
* @method disable
* @public
* @chainable
* @example
* ClassName.prototype.disable = function() {
* if (this.isEnabled === false) { return this; }
*
* this._childInstance.removeEventListener(BaseEvent.CHANGE, this.handlerMethod, this);
* this._childInstance.disable();
*
* return _super.prototype.disable.call(this);
* }
*/
public disable():any
{
if (this.isEnabled === false)
{
return this;
}
this.isEnabled = false;
return this;
}
}
}