Skip to content

Overridable pod's init function #2

@jonyrock

Description

@jonyrock

I propose to make it possible for chartwer pod creators:

import { ChartwerkPod } from '@chartwerk/base';

export class MyChartwerkPod extends ChartwerkPod<any, any> {
  constructor(el: HTMLElement, _series: any[] = [], _options: any = {}) {
    super(d3, el, _series, _options);
    this.init();
  }

  // overriding of super.init();
  protected init() {
    super.init();
    // my init logic here
  }

This approach is very common to UI libs. Overriding of init function is crucial for polymorphic usage of pods. For example, we want to send our pod to a class which initializes pods in a spacial order, but client code can't reach that logic.
It other hand, we are not obligated to overload init method, which is also good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions