UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

44 lines (43 loc) • 1.21 kB
/** * DevExtreme (esm/__internal/viz/vector_map/data_exchanger.js) * Version: 26.1.6 * Build date: Fri Oct 16 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import { Callbacks } from "../../core/utils/callbacks"; export let DataExchanger = class { constructor() { this._store = {} } dispose() { this._store = null; return this } _get(category, name) { const store = this._store[category] || (this._store[category] = {}); return store[name] || (store[name] = { callbacks: Callbacks() }) } set(category, name, data) { const item = this._get(category, name); item.data = data; item.callbacks.fire(data); return this } bind(category, name, callback) { const item = this._get(category, name); item.callbacks.add(callback); item.data && callback(item.data); return this } unbind(category, name, callback) { const item = this._get(category, name); item.callbacks.remove(callback); return this } };