UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

36 lines (35 loc) 993 B
/** * DevExtreme (esm/__internal/core/m_memorized_callbacks.js) * Version: 24.2.6 * Build date: Mon Mar 17 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import Callbacks from "../../core/utils/callbacks"; import { each } from "../../core/utils/iterator"; class MemorizedCallbacks { constructor() { this.memory = []; this.callbacks = Callbacks() } add(fn) { each(this.memory, ((_, item) => fn.apply(fn, item))); this.callbacks.add(fn) } remove(fn) { this.callbacks.remove(fn) } fire() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key] } this.memory.push(args); this.callbacks.fire.apply(this.callbacks, args) } } export { MemorizedCallbacks };