UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

31 lines (30 loc) 701 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChartStore = void 0; class ChartStore { constructor(value) { this.value = void 0; this.listeners = void 0; this.subscribe = fn => { this.listeners.add(fn); return () => { this.listeners.delete(fn); }; }; this.getSnapshot = () => { return this.value; }; this.update = updater => { const newState = updater(this.value); if (newState !== this.value) { this.value = newState; this.listeners.forEach(l => l(newState)); } }; this.value = value; this.listeners = new Set(); } } exports.ChartStore = ChartStore;