-
Notifications
You must be signed in to change notification settings - Fork 69
Add JS Loaders #123
base: master
Are you sure you want to change the base?
Add JS Loaders #123
Conversation
mcaskill
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Regarding the new
Appclass, it's a good convention to have the class and the entry point file be separate:A file SHOULD declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it SHOULD execute logic with side effects, but SHOULD NOT do both.
The phrase "side effects" means execution of logic not directly related to declaring classes, functions, constants, etc., merely from including the file.
— PSR-1: Basic Coding Standard, PHP-FIG -
Following the previous, should
window.addEventListener('load', () => this.load())be defined in the entry point file, after creating theAppobject?const app = new App() window.addEventListener('load', () => app.load())
-
Previously,
modularwas our "Application". Now that a dedicatedAppclass has been introduced, I suggest renaming the property tothis.modular,this.manager, orthis.moduleManager.Or maybe have
Appextend themodularclass? -
Inline comments (such as "Add custom events", "Set vars", "Window events", "Instanciate app") are somewhat redundant given most of the following lines are self explanatory. If anything, these inline comments should be moved to block comments next to their matching declarations.
|
Outcome from meeting on 2022-10-05
|
Create loaders utils based on Fournier.
Reformat
app.jswith a js class, and add useful methods (load, init, addCustomEvents, setVars) that are triggered on app mount.The
loaders.jsandapp.jsare W.I.P, improvements are welcome !