UNPKG

@adaptabletools/adaptable

Version:

Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements

41 lines (40 loc) 1.24 kB
/** * Base class for all AdapTable Plugins */ export class AdaptablePlugin { constructor(options) { this.pluginId = ''; this.options = options; this.values = {}; } registerProperty(name, fn) { this.values[name] = fn; } getProperty(name) { return (...args) => { const fn = this.values[name]; if (fn) { return fn(...args); } }; } hasProperty(name) { return !!this.values[name]; } // plugin lifecycle methods, executed in this exact order // wondering if this is better? beforeInit(adaptableOptions, // adding a nested object allows plugins to modify gridOptions agGridOptions) { } afterInitOptions(adaptable, adaptableOptions) { } afterInitApi(adaptable, api) { } afterInitServices(adaptable) { } afterInitialStateLoaded(adaptable) { } afterInitModules(adaptable, strategies) { } afterInitStore(adaptable) { } afterInit(ab) { } // hook executed after each layout update (Adaptable.setLayout()) afterSetLayout(adaptable, layout) { } onStoreEvent(eventName, data, adaptableStore) { } onAdaptableReady(adaptable, adaptableOptions) { } }