This is definition of Options
```
export type Options = {
margin?: Margin;
eventsCallbacks?: {
....
```
I think better name just "events" like everywhere in js
@vargburz what do you think?
export class CoreOptions<O extends Options> {
_options: O;
constructor(options: O, private _podDefaults?: Partial<O>) {
this.setOptions(options);
}
public updateOptions(options: O): void {
this.setOptions(options);
}
...
and transform
export type Options = {
margin?: Margin;
this to class
because in index.ts we do
constructor(
protected readonly el: HTMLElement,
_series: T[] = [],
_options: O
) {
// TODO: test if it's necessary
styles.use();
this.options = new CoreOptions(_options);
this.series = new CoreSeries(_series);
anyway
Doing this I found even deeper bad code.
I belive that we don't need CoreOptions
```
export class CoreOptions<O extends Options> {
_options: O;
constructor(options: O, private _podDefaults?: Partial<O>) {
this.setOptions(options);
}
public updateOptions(options: O): void {
this.setOptions(options);
}
...
```
and transform
```
export type Options = {
margin?: Margin;
```
this to class
because in index.ts we do
```
constructor(
protected readonly el: HTMLElement,
_series: T[] = [],
_options: O
) {
// TODO: test if it's necessary
styles.use();
this.options = new CoreOptions(_options);
this.series = new CoreSeries(_series);
```
anyway
This is definition of Options
I think better name just "events" like everywhere in js
@vargburz what do you think?
agree, events sounds better
I shoudl add that eventsCallbacks is obsolete code and keep it for backward compatibility
rename evenctCallbacs to eventsto rename eventCallbacs to events 10 months agoDoing this I found even deeper bad code.
I belive that we don't need CoreOptions
and transform
this to class
because in index.ts we do
anyway
I think that
CoreOptions
should be renamed toOptinos
,when original
Options
toOptionsConfig
and remove generic for
o extends Options
because client code should inheritCoreOptions
and resolve it's config.