onSubmit() { const input = { type: 'user', sessionId: this.wsSessionId, msg: this.userMsg, tz: this.timezone }; this.ws$.next(JSON.stringify(input)); this.pushMsg(input, true); this.botIsTyping = true; }
constructor( private afterStarterService: AfterStarterService, private daemonService: DaemonService ) { this.afterStarterService.appStarted.subscribe(() => this.daemonService.notifyDaemon() ); }
it('should return dataSubject as an Observable', inject([SendPageDataService], (service: SendPageDataService) => { this.testDataStream = service.dataSubject.asObservable() this.dataStream = service.getDataStream() expect(this.dataStream).toEqual(this.testDataStream) }));
sendData(){ this.validateDataBundle(this.dataBundle) this.dataBundle.changellyFeeOne = this.dataBundle.changellyFeeOne.toString() || undefined this.dataBundle.estConvToNav = this.dataBundle.estConvToNav.toString() || undefined this.dataStored = true this.dataSubject.next(this.dataBundle) console.log('data sent') }
announceProjectSelected(project: ProjectModel){ if(project){ this.projectIdSelected = project._id; } else { this.projectIdSelected = null; } this.announceSuiteSelected(null); this.selectedProject.next(project); }
async register() { await Container.set(OrbitDb, new orbitDb(this.ipfs)); const odbContainer: OrbitDb = Container.get(OrbitDb); this.exitHandlerService.errorHandler.subscribe(() => { odbContainer.stop(); odbContainer.disconnect(); }); }
it('should be able to clear it\'s data', inject([SendPageDataService], (service: SendPageDataService) => { this.blankBundle = service.dataBundle service.dataBundle = this.testDataBundle //fill with data spyOn(service.dataSubject, 'next').and.stub() service.clearData(true) expect(service.dataBundle).toEqual({errors: []}) expect(service.dataSubject.next).toHaveBeenCalledWith(service.dataBundle) }));
// Subscribe subject.subscribe( data => console.log('Next', data), error => console.error('Error', error), () => console.log('Complete') );
_redisConnection.on('message', function(channel, message) { const msg = `Message ${message} on channel ${channel} arrived!`; typeof callback === 'function' && callback.call(null, msg); _wsMessage.next(msg); });
it('should pass data into the dataSubject', inject([SendPageDataService], (service: SendPageDataService) => { spyOn(service.dataSubject, 'next').and.stub() service.dataBundle = this.testDataBundle service.dataStored = false service.getData() expect(service.dataSubject.next).not.toHaveBeenCalled() service.dataStored = true service.getData() expect(service.dataSubject.next).toHaveBeenCalledWith(service.dataBundle) }));
clearData(broadcastChanges: boolean ): void { this.dataBundle = {errors: []} this.setDataStatus('UNSET') if(broadcastChanges) this.dataSubject.next(this.dataBundle) }
announceSuiteSelected(suite: SuiteModel){ if(suite){ this.suiteIdSelected = suite._id; } else { this.suiteIdSelected = null; } this.announceFeatureSelected(null); this.selectedSuite.next(suite); }
announceProjectSelected(project: ProjectModel){ if(project){ this.projectIdSelected = project._id; } else { this.projectIdSelected = null; } this.announceSuiteSelected(null); this.selectedProject.next(project); }