From 4ae6ab340cfa77aedc54097cc3577730b36f90c1 Mon Sep 17 00:00:00 2001 From: Vitaly Tomilov Date: Sun, 29 Sep 2024 23:00:32 +0100 Subject: [PATCH] refactoring --- package.json | 2 +- src/event.ts | 5 +++-- typedoc.json | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 1a96e0b..e0f3f5c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sub-events", - "version": "2.0.0-beta.1", + "version": "1.10.0", "description": "Lightweight, strongly-typed events, with monitored subscriptions.", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", diff --git a/src/event.ts b/src/event.ts index 713dfcc..55d8366 100644 --- a/src/event.ts +++ b/src/event.ts @@ -218,7 +218,8 @@ export class SubEvent { /** * Last emitted event, if there was any, or `undefined` otherwise. * - * It is set after all subscribers have received the event. + * It is set after all subscribers have received the event, but just before + * optional {@link IEmitOptions.onFinished} callback is invoked. */ get lastEvent(): T | undefined { return this._lastEvent; @@ -377,10 +378,10 @@ export class SubEvent { } if (index === r.length - 1) { // the end of emission reached; + this._lastEvent = data; // save the last event if (onFinished) { onFinished(r.length); // notify } - this._lastEvent = data; // save the last event } })); }); diff --git a/typedoc.json b/typedoc.json index 94aaff0..6be27e2 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,6 +1,6 @@ { "$schema": "https://typedoc.org/schema.json", - "name": "SUB-EVENTS v2.0.0-beta.1", + "name": "SUB-EVENTS v1.10.0", "out": "./docs", "excludeExternals": true, "excludePrivate": true,