-
Notifications
You must be signed in to change notification settings - Fork 70
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
Add JS Loaders #123
base: master
Are you sure you want to change the base?
Add JS Loaders #123
Conversation
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
App
class, 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 theApp
object?const app = new App() window.addEventListener('load', () => app.load())
-
Previously,
modular
was our "Application". Now that a dedicatedApp
class has been introduced, I suggest renaming the property tothis.modular
,this.manager
, orthis.moduleManager
.Or maybe have
App
extend themodular
class? -
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.js
with a js class, and add useful methods (load, init, addCustomEvents, setVars) that are triggered on app mount.The
loaders.js
andapp.js
are W.I.P, improvements are welcome !