UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

57 lines (56 loc) 1.72 kB
/** * DevExtreme (cjs/ui/html_editor/modules/widget_collector.js) * Version: 23.2.6 * Build date: Wed May 01 2024 * * Copyright (c) 2012 - 2024 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; exports.default = void 0; var _iterator = require("../../../core/utils/iterator"); let WidgetCollector = function() { function WidgetCollector() { this._collection = [] } var _proto = WidgetCollector.prototype; _proto.clear = function() { this._collection = [] }; _proto.add = function(name, instance) { this._collection.push({ name: name, instance: instance }) }; _proto.remove = function(name) { this._collection = this._collection.filter(item => item.name !== name) }; _proto.getByName = function(widgetName) { let widget = null; (0, _iterator.each)(this._collection, (index, _ref) => { let { name: name, instance: instance } = _ref; if (name === widgetName) { widget = instance; return false } }); return widget }; _proto.each = function(handler) { this._collection.forEach(_ref2 => { let { name: name, instance: instance } = _ref2; return instance && handler(name, instance) }) }; return WidgetCollector }(); exports.default = WidgetCollector; module.exports = exports.default; module.exports.default = exports.default;