mirror of
https://github.com/meshcore-dev/meshcore.js.git
synced 2026-04-20 22:13:49 +00:00
add helper to fetch all waiting messages, and add command bot example
This commit is contained in:
parent
166762dc31
commit
a03023b771
3 changed files with 102 additions and 30 deletions
|
|
@ -780,6 +780,27 @@ class Connection extends EventEmitter {
|
|||
});
|
||||
}
|
||||
|
||||
async getWaitingMessages() {
|
||||
|
||||
const waitingMessages = [];
|
||||
|
||||
while(true){
|
||||
|
||||
// get next message, otherwise stop if nothing is returned
|
||||
const message = await this.syncNextMessage();
|
||||
if(!message){
|
||||
break;
|
||||
}
|
||||
|
||||
// add to waiting messages list
|
||||
waitingMessages.push(message);
|
||||
|
||||
}
|
||||
|
||||
return waitingMessages;
|
||||
|
||||
}
|
||||
|
||||
getDeviceTime() {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue