Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(private actions$: Actions) {
this.actions$.pipe(ofActionDispatched(Login)).subscribe(action => console.log('Login.......Action Dispatched'));
this.actions$.pipe(ofActionSuccessful(Login)).subscribe(action => console.log('Login........Action Successful'));
this.actions$.pipe(ofActionErrored(Login)).subscribe(action => console.log('Login........Action Errored'));
}
}
subscribeTo() {
this.store.dispatch(new EventListenerAdd('resize'));
this.resize$
.pipe(
filter(event => !!event),
takeUntilNotNull(this.destroy$),
)
.subscribe(_ => this.hide());
this.actions
.pipe(
ofActionDispatched(EventListenerScrollVertical),
takeUntilNotNull(this.destroy$),
)
.subscribe(_ => this.hide());
}
}
private setupActionsListeners(): void {
this.actions$.pipe(ofActionDispatched(ConnectWebSocket)).subscribe(({ payload }) => {
this.connect(payload);
});
this.actions$.pipe(ofActionDispatched(DisconnectWebSocket)).subscribe(() => {
this.disconnect();
});
this.actions$.pipe(ofActionDispatched(SendWebSocketMessage)).subscribe(({ payload }) => {
this.send(payload);
});
}
private subscribeToActionDispatched(): void {
this.actions$
.pipe(
ofActionDispatched(LoadContent),
takeUntil(this.unsubscriber$)
)
.subscribe(() => {
this.inProgress = true;
this.errorString = null;
});
}
constructor(
private ble: BLE,
private platform: Platform,
private actions$: Actions,
private store: Store,
private diagnostic: Diagnostic,
private alertService: AlertService,
private translateService: TranslateService,
private devicesService: DevicesService
) {
this.actions$.pipe(ofActionDispatched(StartDiscoverBLEDevices)).subscribe(() => {
if (this.currentAlert) {
this.currentAlert.dismiss();
this.currentAlert = undefined;
}
});
}
constructor(
store: Store,
actions: Actions,
socket: WebSocketSubject,
@Inject(NGXS_WEBSOCKET_OPTIONS) config: NgxsWebsocketPluginOptions,
) {
actions.pipe(ofActionDispatched(ConnectWebSocket)).subscribe(event => socket.connect(event.payload));
actions.pipe(ofActionDispatched(DisconnectWebSocket)).subscribe(event => socket.disconnect());
actions.pipe(ofActionDispatched(SendWebSocketAction)).subscribe(({ payload }) => {
const type = getActionTypeFromInstance(payload);
socket.send({ ...payload, type });
});
actions.pipe(ofActionDispatched(AuthenticateWebSocket)).subscribe(event => socket.auth({ sumo: 1 }));
socket.connectionStatus.pipe(distinctUntilChanged()).subscribe(status => {
if (status) {
store.dispatch(new WebSocketConnected({ socketId: socket.id }));
} else {
store.dispatch(new WebSocketDisconnected());
}
});
socket.subscribe(
msg => {
const type = getValue(msg, config.typeKey);
if (!type) {
throw new Error(`Type ${type} not found on message`);
constructor(
private nlp: NlpService,
private stt: SpeechToTextService,
private tts: TextToSpeechService,
private chat: ChatService,
private store: Store,
private actions$: Actions,
) {
this.actions$.pipe(ofActionDispatched(AddMessage)).subscribe((action: AddMessage) => {
switch (action.payload.message.to.type) {
case SubjectType.BOT:
return this.nlp.process(action.payload.message.content).then(speech => {
store.dispatch(
new AddMessage({
conversationId: action.payload.conversationId,
message: ChatMessage.fromBotMessage(speech),
}),
);
if (action.payload.message.mode === ModeType.SPEAK) {
this.tts.synthesisVoice(speech, this.store.selectSnapshot(ChatBoxState.getVoicePreference));
}
});
case SubjectType.USER:
case SubjectType.ADMIN:
case SubjectType.GROUP:
subscribeTo() {
this.store.dispatch(new EventListenerAdd('resize'));
this.resize$
.pipe(
filter(event => !!event),
takeUntilNotNull(this.destroy$),
)
.subscribe(_ => this.hide());
this.actions
.pipe(
ofActionDispatched(EventListenerScrollVertical),
takeUntilNotNull(this.destroy$),
)
.subscribe(_ => this.hide());
}
}
private setupActionsListeners(): void {
this.actions$.pipe(ofActionDispatched(ConnectWebSocket)).subscribe(({ payload }) => {
this.connect(payload);
});
this.actions$.pipe(ofActionDispatched(DisconnectWebSocket)).subscribe(() => {
this.disconnect();
});
this.actions$.pipe(ofActionDispatched(SendWebSocketMessage)).subscribe(({ payload }) => {
this.send(payload);
});
}