mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-04 14:47:20 +00:00
Destroyed Module System Proposal (asciidoc)
parent
2bb30fb96c
commit
11a82c1b47
@ -1,45 +0,0 @@
|
|||||||
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:
|
|
||||||
|
|
||||||
image::http://i.imgur.com/mshIn9n.png[regions]
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
`function jsFileForModule() { ... }` - This returns an array of urls to js 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. There should be a way to start scripts (python, node etc.) as daemons. Maybe some kind of API to send data back to the modules should be implemented (socket.io & UNIX sockets).
|
|
||||||
|
|
||||||
## API Design
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
_... please edit with your suggestions ...._
|
|
Loading…
x
Reference in New Issue
Block a user