Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overridable pod's init function #2

Open
jonyrock opened this issue Dec 20, 2020 · 0 comments
Open

Overridable pod's init function #2

jonyrock opened this issue Dec 20, 2020 · 0 comments

Comments

@jonyrock
Copy link
Contributor

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.

@jonyrock jonyrock transferred this issue from chartwerk/base Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant