Gaia/System/NewModule: Difference between revisions

No edit summary
Line 32: Line 32:
Don't put your new script in the header of system app.
Don't put your new script in the header of system app.
If it's necessary to go alive when booting, please find a proper parent module and lazy load it.
If it's necessary to go alive when booting, please find a proper parent module and lazy load it.
If you are using BaseModule,
 
=== If the parent module is based on BaseModule ===
1. Put the module in the parent module's SUB_MODULES if you think it's blocking the starting progress of the parent module. 2. If the new module is not as important to block the parent, use this.loadWhenIdle([NEW_MODULE]) in parent's start function
1. Put the module in the parent module's SUB_MODULES if you think it's blocking the starting progress of the parent module. 2. If the new module is not as important to block the parent, use this.loadWhenIdle([NEW_MODULE]) in parent's start function
3. If the new module is only serving some on demand request, consider to lazy load the new module in the parent module's event handler and start it.
3. If the new module is only serving some on demand request, consider to lazy load the new module in the parent module's event handler and start it.
=== If the parent module is not based on BaseModule ===
1. Lazy load the module in the parent module's start function and return a promise including the promise of the lazy loader
2. If the new module is only serving some on demand request, consider to lazy load the new module in the parent module's event handler and start it.
Confirmed users
401

edits