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

Pass initApp() params as object #52

Merged
merged 1 commit into from
Dec 17, 2023
Merged

Commits on Dec 17, 2023

  1. Pass initApp() params as object

    Now all parameters that initApp() may pass through to each individual
    component's init() function are bundled into a single object.
    
    Other small but significant changes:
    
    - Removes window and document from the parameter list for now, as
      there's no components that need to inject them.
    
    - Sets up a list of components in initApp() so that it can call each
      component's init() via forEach(). This eliminates the need to add a
      new line for each init() call for each added component.
    
    - Sets initApp() to run only once on DOMContentLoaded.
    
    - Removes the now unused fragment() test helper (should've been part of
      commit 5f2a917 from #51).
    
    ---
    
    While adding the Calculator component, it became apparent that adding
    more params to main.js and initApp() to pass through to init() was
    becoming unwieldy. This solution makes future extension easier and the
    code cleaner while decoupling component initializer signatures from one
    another.
    mbland committed Dec 17, 2023
    Configuration menu
    Copy the full SHA
    75681ad View commit details
    Browse the repository at this point in the history