UNPKG

highcharts

Version:
93 lines (92 loc) 2.11 kB
/** * * (c) 2010-2021 Paweł Fus * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ 'use strict'; /* * * * Composition * * */ var ChartNavigationComposition; (function (ChartNavigationComposition) { /* * * * Declarations * * */ /* * * * Functions * * */ /* eslint-disable valid-jsdoc */ /** * @private */ function compose(chart) { if (!chart.navigation) { chart.navigation = new Additions(chart); } return chart; } ChartNavigationComposition.compose = compose; /* * * * Class * * */ /** * Initializes `chart.navigation` object which delegates `update()` methods * to all other common classes (used in exporting and navigationBindings). * @private */ var Additions = /** @class */ (function () { /* * * * Constructor * * */ function Additions(chart) { this.updates = []; this.chart = chart; } /* * * * Functions * * */ /** * Registers an `update()` method in the `chart.navigation` object. * * @private * @param {UpdateFunction} updateFn * The `update()` method that will be called in `chart.update()`. */ Additions.prototype.addUpdate = function (updateFn) { this.chart.navigation.updates.push(updateFn); }; /** * @private */ Additions.prototype.update = function (options, redraw) { var _this = this; this.updates.forEach(function (updateFn) { updateFn.call(_this.chart, options, redraw); }); }; return Additions; }()); ChartNavigationComposition.Additions = Additions; })(ChartNavigationComposition || (ChartNavigationComposition = {})); /* * * * Default Export * * */ export default ChartNavigationComposition;