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

Attribute Transformers #57

Open
jeswin opened this issue Apr 23, 2022 · 0 comments
Open

Attribute Transformers #57

jeswin opened this issue Apr 23, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@jeswin
Copy link
Member

jeswin commented Apr 23, 2022

Initial discussion at #54

Parts of the discussion are copied below for context:

Initial proposal by @spiffytech

Forgo could allow libraries to implement this if component had a method to modify attributes before they're put onto the DOM. Something like:

function someFunc() {
  transformAttr(name, value, args) {
    if (name.startsWith('on')) {
      return autoRedraw(value, args);
    }
    return value;
  },
  render() {...}
}

Then you could imagine a library exposing this the same way forgo-state accepts a component and returns a component with modified lifecycle methods.

Pair this with wanting click handlers to run inside the component's error boundary and we've got two examples where modifying DOM node attributes is useful.

@jeswin jeswin added the enhancement New feature or request label Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant