smartuniverse/ts/smartuniverse.classes.reactionresponse.ts

32 lines
1.3 KiB
TypeScript
Raw Normal View History

2019-09-09 22:39:18 +00:00
import * as plugins from './smartuniverse.plugins';
2019-09-10 17:36:10 +00:00
import { ICombinatorPayload } from './smartuniverse.classes.reactionrequest';
import { UniverseChannel } from './smartuniverse.classes.universechannel';
import { ClientUniverseChannel } from './smartuniverse.classes.clientuniversechannel';
import { UniverseMessage } from './smartuniverse.classes.universemessage';
import { ClientUniverseMessage } from './smartuniverse.classes.clientuniversemessage';
export interface IReactionResponseConstructorOptions<T extends plugins.typedrequestInterfaces.ITypedRequest> {
method: T['method'];
channels: Array<UniverseChannel | ClientUniverseChannel>;
}
export class ReactionResponse<T extends plugins.typedrequestInterfaces.ITypedRequest> {
public method: T['method'];
public channels = new plugins.lik.Objectmap<UniverseChannel | ClientUniverseChannel>();
constructor(optionsArg: IReactionResponseConstructorOptions<T>) {
this.channels.addArray(optionsArg.channels);
for (const channel of this.channels.getArray()) {
channel.subscribe(messageArg => {
this.processMessageForReaction(messageArg);
});
}
}
2019-09-10 21:55:20 +00:00
private processMessageForReaction(messageArg: UniverseMessage<ICombinatorPayload<T>> | ClientUniverseMessage<ICombinatorPayload<T>>) {
2019-09-10 17:36:10 +00:00
}
2019-09-10 16:03:46 +00:00
}