Skip to content

Commit

Permalink
make listener callback on patcher subscribe optional
Browse files Browse the repository at this point in the history
  • Loading branch information
loreanvictor committed May 6, 2024
1 parent 9e11c01 commit 1b92e1f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/services/patcher/patcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class Patcher<T> {
* @param listener A function that will be called when the object changes.
* @returns A subscription ID that can be used to unsubscribe.
*/
subscribe(listener: PatchListener): number {
subscribe(listener?: PatchListener): number {
const key = this.nextKey();
this.subscribers[key] = this.observable.subscribe(listener);

Expand Down
2 changes: 1 addition & 1 deletion src/tests/unit/services/patcher/patcher-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ describe('patcher class.', () => {
test('suppresses patches on a changed address for a limited time.', async () => {
const patcher = new Patcher();
patcher.initialize({ x: 42 });
patcher.subscribe(() => {});
patcher.subscribe();
patcher.check({ x: 43 });

await sleep(1);
Expand Down

0 comments on commit 1b92e1f

Please sign in to comment.