Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ release date when you use `npm version` (see `README.md`).

## [Unreleased]

- Make `webxdc.setUpdateListener` API work correctly with async callbacks

## [2.1.2][] - 2024-11-27

### Fixed
Expand Down
16 changes: 9 additions & 7 deletions webxdc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ export type SendingStatusUpdate<PayloadType> = {
};

export type ReceivedStatusUpdate<PayloadType> = SendingStatusUpdate<PayloadType> & {
/** the serial number of this update. Serials are larger than 0 and newer serials have higher numbers */
serial: number;
/** the maximum serial currently known */
max_serial: number;
};
/** the serial number of this update. Serials are larger than 0 and newer serials have higher numbers */
serial: number;
/** the maximum serial currently known */
max_serial: number;
};

export type XDCFile = {
/** name of the file, including extension */
Expand Down Expand Up @@ -99,8 +99,10 @@ export interface Webxdc<StatusPayload> {
* @returns promise that resolves when the listener has processed all the update messages known at the time when {@link setUpdateListener} was called.
* */
setUpdateListener(
cb: (statusUpdate: ReceivedStatusUpdate<StatusPayload>) => void,
serial?: number,
cb: (
statusUpdate: ReceivedStatusUpdate<StatusPayload>
) => void | Promise<void>,
serial?: number
): Promise<void>;

/**
Expand Down