observable

Observable and how to control results pace

喜夏-厌秋 提交于 2019-12-12 17:51:06
问题 I am looking for an operator that would help me pace the results emitted from an observable, it would look like this : [--A-BC--D-E----------------] [--A----B----C----D----E----] I tried AuditTime() but it does not replay the results that was emitted between intervals, it does something like this : [--A-BC--D-E----------------] [--A----C----E--------------] Thanks for your help. 回答1: I think this should do what you need: const e1 = cold('--A-BC--D-E----------------|'); const expected = '--A--

You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable

六眼飞鱼酱① 提交于 2019-12-12 17:26:18
问题 Say I have the following function references: const externalRequests = (params) => Rx.Observable.zip( externalApi1(params), externalApi2(params) ) and const internalDB = (params) => Rx.Observable.fromPromise(getStuffFromDB(params) externalRequests returns something of the shape: { _isScalar: false, source: { _isScalar: false, source: { _isScalar: false, array: [Object], scheduler: undefined }, operator: { project: [Object] } }, operator: undefined } and can be .subscribe 'd to. internalDB ,

JavaFX SimpleObjectProperty<T> vs SimpleTProperty

坚强是说给别人听的谎言 提交于 2019-12-12 17:24:00
问题 What's the difference between using SimpleStringProperty vs SimpleObjectProperty < String > or SimpleIntegerProperty vs SimpleObjectProperty< Integer > Besides returning wrappers and not primitive types?(It can be auto casted anyways) 回答1: The API adds additional functionality for the specific types. So ObjectProperty really just defines the API for "being a property" and can only define functionality common to all possible types. On the other hand, StringProperty defines (via its superclass

Use Observer in Fragment

五迷三道 提交于 2019-12-12 16:09:48
问题 I've a problem when using an observer in a fragment, I've implemented my own TextViewObserver, and I wan't to insert it in a Fragment: public class TextViewObserver extends TextView implements Observer { public TextViewObserver(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public TextViewObserver(Context context, AttributeSet attrs) { super(context, attrs); } public TextViewObserver(Context context) { super(context); } @Override public void update

Angular rxjs Observable.interval() not triggering properly on background tabs in Chrome

柔情痞子 提交于 2019-12-12 15:35:58
问题 I am writing angular2 application with interval timers implemented via RxJs observables, and just noticed the strange behaviour of Observable.interval() and Observable.timer() in Chrome browser when tab is in background. Angular component should once every second print number of seconds in console, but on background tabs, this is not working as intended - function triggers every x+1 seconds, where x is interval specified explicitely in the interval funciton Angular component code: ngOnInit()

Property 'catchError' does not exist on type 'Observable<HttpEvent<any>>'

时光怂恿深爱的人放手 提交于 2019-12-12 15:20:28
问题 Went from angular 5 to 6(using angular 6 & rxjs 6), getting the following two errors in my linter. Anybody have any ideas, please and thank you. [ts] 'catchError' is declared but its value is never read. [ts] Property 'catchError' does not exist on type 'Observable<HttpEvent<any>>'. import { Injectable, Injector } from '@angular/core'; import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http'; import { catchError } from 'rxjs/operators'; import { Observable }

Angular2 Karma test says “TypeError: this._subscribe is not a function”

♀尐吖头ヾ 提交于 2019-12-12 14:40:20
问题 I have an Angular 2 application that works OK so far. My GlobalsService.getGlobals() fetches "USA States" through my OptionService.getOptions(). Where my code falls down is in Karma / Jasmine testing. When I call getGlobals() in my current test setup I get the "this._subscribe is not a function" error. I'm finding it hard to debug this because Google Chrome isn't cooperating. My getGlobals() code with debugging added. I split the code between getOptions() and .subscribe() to see what is going

Empty subscribe on valueChanges in Angular2

匆匆过客 提交于 2019-12-12 12:45:25
问题 I have this weird case, a subscribe that never fires if left empty. This doesn't work: this.formGroup.get('unitCount').valueChanges .do(value => console.log(value)) .subscribe(); When this works fine: this.formGroup.get('unitCount').valueChanges .do(value => console.log(value)) .subscribe(() => true); Here I used () => true , but it could anything, false , void 0 , even an empty object {} Why can't I leave the subscribe() empty? 回答1: You probably have a older version of RxJS 5. This was a bug

Angular 2 AsynPipe isn't working with an Observable

烈酒焚心 提交于 2019-12-12 11:06:36
问题 I'm getting the following error: EXCEPTION: Cannot find a differ supporting object '[object Object]' in [files | async in Images@1:9] Here's the relevant part of the template: <img *ngFor="#file of files | async" [src]="file.path"> Here's my code: export class Images { public files: any; public currentPage: number = 0; private _rawFiles: any; constructor(public imagesData: ImagesData) { this.imagesData = imagesData; this._rawFiles = this.imagesData.getData() .flatMap(data => Rx.Observable

How can I use ag-grid with Observable in angular2?

拜拜、爱过 提交于 2019-12-12 10:43:42
问题 I have done lots of research on Internet but still cannot glue these together. I have an angular2 application, with Observable data source from HTTP, and would like to use ag-grid. The problem is I only got a loading screen instead of the data. I have investigated with Fiddler, the data is loaded successfully and correctly in JSON. Here is my code: order.service.ts import { Injectable } from '@angular/core'; import { Headers, Http, Response } from '@angular/http'; import { Observable } from