| 143 | } |
| 144 | |
| 145 | emitStatusChange<T extends CollectionStatus>( |
| 146 | status: T, |
| 147 | previousStatus: CollectionStatus, |
| 148 | ) { |
| 149 | this.emit(`status:change`, { |
| 150 | type: `status:change`, |
| 151 | collection: this.collection, |
| 152 | previousStatus, |
| 153 | status, |
| 154 | }) |
| 155 | |
| 156 | // Emit specific status event using type assertion |
| 157 | const eventKey: `status:${T}` = `status:${status}` |
| 158 | this.emit(eventKey, { |
| 159 | type: eventKey, |
| 160 | collection: this.collection, |
| 161 | previousStatus, |
| 162 | status, |
| 163 | } as AllCollectionEvents[`status:${T}`]) |
| 164 | } |
| 165 | |
| 166 | emitSubscribersChange( |
| 167 | subscriberCount: number, |