1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var tslib_1 = require("tslib");
|
4 | var event_emitter_1 = tslib_1.__importDefault(require("@antv/event-emitter"));
|
5 |
|
6 |
|
7 |
|
8 | var Base = (function (_super) {
|
9 | tslib_1.__extends(Base, _super);
|
10 | function Base(cfg) {
|
11 | var _this = _super.call(this) || this;
|
12 |
|
13 | _this.destroyed = false;
|
14 | var _a = cfg.visible, visible = _a === void 0 ? true : _a;
|
15 | _this.visible = visible;
|
16 | return _this;
|
17 | }
|
18 | |
19 |
|
20 |
|
21 | Base.prototype.show = function () {
|
22 | var visible = this.visible;
|
23 | if (!visible) {
|
24 | this.changeVisible(true);
|
25 | }
|
26 | };
|
27 | |
28 |
|
29 |
|
30 | Base.prototype.hide = function () {
|
31 | var visible = this.visible;
|
32 | if (visible) {
|
33 | this.changeVisible(false);
|
34 | }
|
35 | };
|
36 | |
37 |
|
38 |
|
39 | Base.prototype.destroy = function () {
|
40 | this.off();
|
41 | this.destroyed = true;
|
42 | };
|
43 | |
44 |
|
45 |
|
46 |
|
47 |
|
48 | Base.prototype.changeVisible = function (visible) {
|
49 | if (this.visible === visible) {
|
50 | return;
|
51 | }
|
52 | this.visible = visible;
|
53 | };
|
54 | return Base;
|
55 | }(event_emitter_1.default));
|
56 | exports.default = Base;
|
57 |
|
\ | No newline at end of file |