Skip to content

Commit

Permalink
feat: handle array events
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisguttandin committed Nov 24, 2023
1 parent 4d44c1c commit f8f51ee
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/factories/timing-provider-constructor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ export const createTimingProviderConstructor = (
),
enforceOrder((event): event is IInitEvent => event.type === 'init'),
concatMap((event) => {
if (event.type === 'array') {
return from(event.events);
}

if (event.type === 'init') {
const {
client: { id: clientId },
Expand Down
8 changes: 8 additions & 0 deletions src/interfaces/array-event.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { INoticeEvent } from './notice-event';
import { IRequestEvent } from './request-event';

export interface IArrayEvent {
events: (INoticeEvent | IRequestEvent)[];

type: 'array';
}
1 change: 1 addition & 0 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './array-event';
export * from './candidate-event';
export * from './check-event';
export * from './closure-event';
Expand Down
4 changes: 2 additions & 2 deletions src/types/incoming-signaling-event.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClosureEvent, IInitEvent, ITerminationEvent } from '../interfaces';
import { IArrayEvent, IClosureEvent, IInitEvent, ITerminationEvent } from '../interfaces';
import { TIncomingNegotiationEvent } from './incoming-negotiation-event';

export type TIncomingSignalingEvent = IClosureEvent | TIncomingNegotiationEvent | IInitEvent | ITerminationEvent;
export type TIncomingSignalingEvent = IArrayEvent | IClosureEvent | TIncomingNegotiationEvent | IInitEvent | ITerminationEvent;

0 comments on commit f8f51ee

Please sign in to comment.