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

esm: refactor hooks – add loader instances #49315

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Aug 25, 2023

  1. esm: refactor hooks – add loader instances

    Previously we had one array for each kind of chain in the variable
    `#chains`; this is probably the most efficient, but it decouples the
    connection between the original `register` call and the hook functions
    themselves.
    
    By adding `#loaderInstances` we can keep track of each time `register`
    is called. This allows, for example, trivially removing the loader later
    on, or associating shared context with a particular `register` call. The
    tradeoff here if we just did this would be that during hook traversal we
    may iterate over a slightly larger number of objects. Instead we keep
    `#hooks` but it is now a derived property; every time `#loaderInstances`
    changes we simply rebuild `#hooks`.
    izaakschroeder committed Aug 25, 2023
    Configuration menu
    Copy the full SHA
    a1aef89 View commit details
    Browse the repository at this point in the history