mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-10 17:24:44 +00:00
First idea of the module loader. :)
parent
34335d8df2
commit
63a6b4b630
44
Module-System-Proposal.asciidoc
Normal file
44
Module-System-Proposal.asciidoc
Normal file
@ -0,0 +1,44 @@
|
||||
With the growing additional features of the MagicMirror, we might want to overhaul the MagicMirror module system, and move all the existing functionalities into default modules. Before we overhaul the the complete system, I'd like to document to proposed API.
|
||||
|
||||
My suggestion is as follows:
|
||||
|
||||
## Module Loader
|
||||
|
||||
We define a few preset regions on the mirror in which we can load modules:
|
||||
|
||||

|
||||
|
||||
In the config, we can set which modules we would like to load:
|
||||
|
||||
modules = {
|
||||
TOP_LEFT: {
|
||||
["clock", {timeFormat: 12, displaySeconds: true, digitFade: false}],
|
||||
["calendar", {maximumEntries: 10, displaySymbol: true, defaultSymbol: 'calendar' urls: [...]}]
|
||||
},
|
||||
TOP_RIGHT: {
|
||||
["weather", {q: 'Baarn,Netherlands', units: 'metric', APPID: '...'}]
|
||||
},
|
||||
LOWER_THIRD: {
|
||||
["compliments", {interval: 30000, fadeInterval: 4000, ...}]
|
||||
},
|
||||
...
|
||||
}
|
||||
|
||||
## Module anatomy
|
||||
|
||||
Every module in the module folder should contain the module.js file defining a class for the module with the following methods:
|
||||
|
||||
`function initModule(region, options) { ... }` - This initializes the module. The region variable can be used to display a different version of the module, depending on the region.
|
||||
|
||||
`function htmlForModule() { ... }` - This returns the html injected into the region. (maybe this should just return a dom object?) T
|
||||
|
||||
`function cssFileForModule() { ... }` - This returns an array of urls to a css files needed by the module.
|
||||
|
||||
Any helper scrips (php) should be in the module folder, and should not affect any other module or the main system.
|
||||
|
||||
|
||||
|
||||
***
|
||||
|
||||
_... please edit with your suggestions ...._
|
||||
|
Loading…
x
Reference in New Issue
Block a user