Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It may just be me, but all of these seem a lot inferior API design then a simple web component. Particularly if I’m asking my users to setup a mutation observer.

Aside: Don’t you need to pass the library function into the callback while constructing the mutation observer?

    import lib, { mutationObserverCallback } from "https://my-lib.example";

    lib({
      target: ".target",
      observer: new MutationObserver(mutationObserverCallback),
    });
Honestly, this feels like so much magic compared to a simple:

    <my-lib>Some Input</my-lib>
where I handle update in my library by listening to the slotchange event.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: