@robotlegsjs/createjs
Version:
CreateJS View Integration with RobotlegsJS
97 lines • 3.59 kB
JavaScript
;
// ------------------------------------------------------------------------------
// Copyright (c) 2017-present, RobotlegsJS. All Rights Reserved.
//
// NOTICE: You are permitted to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
// ------------------------------------------------------------------------------
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContainerBinding = void 0;
var tslib_1 = require("tslib");
var core_1 = require("@robotlegsjs/core");
var ContainerBindingEvent_1 = require("./ContainerBindingEvent");
// [Event(name="bindingEmpty", type="robotlegs.bender.extensions.viewManager.impl.ContainerBindingEvent")]
/**
* @private
*/
var ContainerBinding = /** @class */ (function (_super) {
tslib_1.__extends(ContainerBinding, _super);
/*============================================================================*/
/* Constructor */
/*============================================================================*/
/**
* @private
*/
function ContainerBinding(container) {
var _this = _super.call(this) || this;
/*============================================================================*/
/* Private Properties */
/*============================================================================*/
_this._handlers = [];
_this._container = container;
return _this;
}
Object.defineProperty(ContainerBinding.prototype, "parent", {
/**
* @private
*/
get: function () {
return this._parent;
},
/**
* @private
*/
set: function (value) {
this._parent = value;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ContainerBinding.prototype, "container", {
/**
* @private
*/
get: function () {
return this._container;
},
enumerable: false,
configurable: true
});
/*============================================================================*/
/* Public Functions */
/*============================================================================*/
/**
* @private
*/
ContainerBinding.prototype.addHandler = function (handler) {
if (this._handlers.indexOf(handler) > -1) {
return;
}
this._handlers.push(handler);
};
/**
* @private
*/
ContainerBinding.prototype.removeHandler = function (handler) {
var index = this._handlers.indexOf(handler);
if (index > -1) {
this._handlers.splice(index, 1);
if (this._handlers.length === 0) {
this.dispatchEvent(new ContainerBindingEvent_1.ContainerBindingEvent(ContainerBindingEvent_1.ContainerBindingEvent.BINDING_EMPTY));
}
}
};
/**
* @private
*/
ContainerBinding.prototype.handleView = function (view, type) {
var length = this._handlers.length;
for (var i = 0; i < length; i++) {
var handler = this._handlers[i];
handler.handleView(view, type);
}
};
return ContainerBinding;
}(core_1.EventDispatcher));
exports.ContainerBinding = ContainerBinding;
//# sourceMappingURL=ContainerBinding.js.map