Merge pull request #24 from deltachat/set-default-serial-in-setUpdateListener

set default value for serial parameter in setUpdateListener
This commit is contained in:
Simon Laux 2022-03-31 14:20:17 +02:00 committed by GitHub
commit 1c7c126a16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

2
webxdc.d.ts vendored
View file

@ -40,7 +40,7 @@ interface Webxdc<T> {
* The "serial" specifies the last serial that you know about (defaults to 0).
* Note that own status updates, that you send with {@link sendUpdate}, also trigger this method
* */
setUpdateListener(cb: (statusUpdate: ReceivedStatusUpdate<T>) => void, serial: number): void;
setUpdateListener(cb: (statusUpdate: ReceivedStatusUpdate<T>) => void, serial?: number): void;
/**
* WARNING! This function is deprecated, see setUpdateListener().
*/

View file

@ -25,7 +25,7 @@ window.webxdc = (() => {
return {
selfAddr: params.get("addr") || "device0@local.host",
selfName: params.get("name") || "device0",
setUpdateListener: (cb, serial) => {
setUpdateListener: (cb, serial = 0) => {
var updates = getUpdates();
var maxSerial = updates.length;
updates.forEach((update) => {