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

Do a pass over CONFIG classes and see when they need a more specific constructor #3004

Open
LukeAbby opened this issue Jan 2, 2025 · 0 comments

Comments

@LukeAbby
Copy link
Collaborator

LukeAbby commented Jan 2, 2025

I recently switched CONFIG to use AnyConstructor more widely. I expect that this will be a positive change in most cases but for example CONFIG.Canvas.groups needs a specific constructor signature because of Canvas##createGroups

  #createGroups(parentName, parent) {
    for ( const [name, config] of Object.entries(CONFIG.Canvas.groups) ) {
      if ( config.parent !== parentName ) continue;
      const group = new config.groupClass();
      Object.defineProperty(this, name, {value: group, writable: false});    // Reference on the Canvas
      Object.defineProperty(parent, name, {value: group, writable: false});  // Reference on the parent
      parent.addChild(group);
      this.#createGroups(name, group);                                       // Recursive
    }
  }

This specific case has of course been accounted for already. What's missing is doing this for all classes in CONFIG to ensure their valid constructors.

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