Skip to content
This repository was archived by the owner on Jul 31, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/state/IState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ export interface IState extends EventEmitter {

reset(): void;

getGroups(): Map<string, IGroup>;
getGroup(id: string): IGroup;
getScenes(): Map<string, IScene>;
getScene(id: string): IScene;
onSceneCreate(data: ISceneData): IScene;
synchronizeScenes(data: ISceneDataArray): IScene[];
synchronizeGroups(data: IGroupDataArray): IGroup[];

getControl(id: string): IControl;

getParticipants(): Map<string, IParticipant>;
getParticipantByUserID(id: number): IParticipant;
getParticipantByUsername(name: string): IParticipant;
getParticipantBySessionID(id: string): IParticipant;
Expand Down
21 changes: 21 additions & 0 deletions src/state/State.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,27 @@ export class State extends EventEmitter implements IState {
return group;
}

/**
* Retrieve all groups.
*/
public getGroups(): Map<string, Group> {
return this.groups;
}

/**
* Retrieve a group with the matching ID from the group store.
*/
public getGroup(id: string): Group {
return this.groups.get(id);
}

/**
* Retrieve all scenes
*/
public getScenes(): Map<string, Scene> {
return this.scenes;
}

/**
* Retrieve a scene with the matching ID from the scene store.
*/
Expand All @@ -336,6 +350,13 @@ export class State extends EventEmitter implements IState {
return result;
}

/**
* Retrieve all participants.
*/
public getParticipants(): Map<string, IParticipant> {
return this.participants;
}

private getParticipantBy<K extends keyof IParticipant>(field: K, value: IParticipant[K]): IParticipant {
let result;
this.participants.forEach(participant => {
Expand Down