mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Module: Alert
The alert module is one of the default modules of the MagicMirror. This module displays notifications from other modules.
Usage
To use this module, add it to the modules array in the config/config.js file:
modules: [
{
module: 'alert',
config: {
// The config property is optional.
// See 'Configuration options' for more information.
}
}
]
Configuration options
The following properties can be configured:
Option | Description |
---|---|
effect |
The animation effect to use for notifications. Possible values: scale slide genie jelly flip exploader bouncyflip
Default value: slide
|
alert_effect |
The animation effect to use for alerts. Possible values: scale slide genie jelly flip exploader bouncyflip
Default value: jelly
|
display_time |
Time a notification is displayed in seconds. Possible values: float int
Default value: 3.5
|
position |
Position where the notifications should be displayed. Possible values: left center right
Default value: 3500
|
welcome_message |
Message shown at startup. Possible values: string false
Default value: Welcome, start was successfull!
|
Developer notes
Display notification
self.sendNotification("SHOW_NOTIFICATION", {title: "Hello", message: "This is a test!"});
Option | Description |
---|---|
title |
The title of the notification. Possible values: text or html
|
message |
The message of the notification. Possible values: text or html
|
Display alert
self.sendNotification("SHOW_ALERT", {title: "Hello", message: "This is a test!", type: "success", imageUrl:"url", imageSize: "50x50", timer:1000});
Option | Description |
---|---|
title |
The title of the alert. Possible values: text or html
|
message |
The message of the alert. Possible values: text or html
|
imageUrl (optional) |
Image to show in the alert Possible values: url
Default value: none
|
imageHeight (optional even with imageUrl set) |
Height of the image Possible values: " int px "
Default value: 80px
|
timer (optional) |
How long the alert should stay visible in seconds. Possible values: int float
Default value: none
Important: If you do not use the `timer`, it is your duty to hide the alert by using self.sendNotification("HIDE_ALERT"); !
|
Open Source Licenses
###NotificationStyles See ympanus.net for license.