@adaptabletools/adaptable-cjs
Version:
Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements
45 lines (44 loc) • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AdaptablePlugin = void 0;
/**
* Base class for all AdapTable Plugins
*/
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) { }
}
exports.AdaptablePlugin = AdaptablePlugin;