Skip to content

Commit

Permalink
Expose extras namespace
Browse files Browse the repository at this point in the history
## Details

- Expose `mediasoup.extras` which (for now) exports `EnhancedEventEmitter`, `Events` and `enhancedOnce()`.
- Useful when writing mocks implementing mediasoup TS interfaces.
  • Loading branch information
ibc committed Nov 11, 2024
1 parent e257dbc commit eaf286b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### NEXT

- Expose `extras` namespace which exports `EnhancedEventEmitter`, `Events` and `enhancedOnce()` for now ([PR #1464](https://github.com/versatica/mediasoup/pull/1464)).

### 3.15.0

- Node: Add TypeScript interfaces for all exported classes ([PR #1463](https://github.com/versatica/mediasoup/pull/1463)).
Expand Down
2 changes: 1 addition & 1 deletion node/src/RtpObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export abstract class RtpObserverImpl<
// Observer instance.
readonly #observer: Observer;

constructor(
protected constructor(
{
internal,
channel,
Expand Down
2 changes: 1 addition & 1 deletion node/src/Transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export abstract class TransportImpl<
// Observer instance.
readonly #observer: Observer;

constructor(
protected constructor(
{
internal,
data,
Expand Down
2 changes: 1 addition & 1 deletion node/src/enhancedEvents.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EventEmitter, once } from 'node:events';

type Events = Record<string, any[]>;
export type Events = Record<string, any[]>;

export class EnhancedEventEmitter<
E extends Events = Events,
Expand Down
1 change: 1 addition & 0 deletions node/src/extras.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { EnhancedEventEmitter, Events, enhancedOnce } from './enhancedEvents';
5 changes: 5 additions & 0 deletions node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,8 @@ export function getSupportedRtpCapabilities(): RtpCapabilities {
* Expose parseScalabilityMode() function.
*/
export { parseScalabilityMode } from './scalabilityModesUtils';

/**
* Expose extras module.
*/
export * as extras from './extras';

0 comments on commit eaf286b

Please sign in to comment.