mirror of https://github.com/espruino/BangleApps
docs - fix #2860
parent
0662bb44f5
commit
cb2760a3f1
|
@ -1,6 +1,6 @@
|
|||
# Messages library
|
||||
|
||||
This library handles the passing of messages. It can storess a list of messages
|
||||
This library handles the passing of messages. It can stores a list of messages
|
||||
and allows them to be retrieved by other apps.
|
||||
|
||||
## Example
|
||||
|
@ -37,18 +37,10 @@ myMessageListener = Bangle.on("message", (type, message)=>{
|
|||
});
|
||||
```
|
||||
|
||||
Apps can launch the full GUI by calling `require("messages").openGUI()`, if you
|
||||
want to write your own GUI, it should include boot code that listens for
|
||||
`"messageGUI"` events:
|
||||
|
||||
```js
|
||||
Bangle.on("messageGUI", message=>{
|
||||
if (message.handled) return; // another app already opened it's GUI
|
||||
message.handled = true; // prevent other apps form launching
|
||||
Bangle.load("my_message_gui.app.js");
|
||||
})
|
||||
|
||||
```
|
||||
Apps can launch the currently installed Message GUI by calling `require("messages").openGUI()`.
|
||||
If you want to write your own GUI, it should include a library called `messagegui`
|
||||
with a method called `open` that will cause it to be opened, with the
|
||||
optionally supplied message. See `apps/messagegui/lib.js` for an example.
|
||||
|
||||
|
||||
## Requests
|
||||
|
|
|
@ -107,7 +107,7 @@ exports.dismiss = function(msg) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Emit a "type=openGUI" event, to open GUI app
|
||||
* Open the Messages GUI app
|
||||
*
|
||||
* @param {object} [msg={}] Message the app should show
|
||||
*/
|
||||
|
@ -215,7 +215,7 @@ exports.buzz = function(msgSrc) {
|
|||
|
||||
let repeat = msgSettings.repeat;
|
||||
if (repeat===undefined) repeat = 4; // repeat may be zero
|
||||
if (repeat)
|
||||
if (repeat)
|
||||
{
|
||||
exports.buzzInterval = setInterval(() => require("buzz").pattern(pattern), repeat*1000);
|
||||
let vibrateTimeout = msgSettings.vibrateTimeout;
|
||||
|
|
Loading…
Reference in New Issue