* RxJS 6

* Don't log observable promise.catch to console

* Extra space
This commit is contained in:
Jaco Greeff
2018-08-07 17:30:18 +02:00
committed by GitHub
parent a0336893a4
commit e2365bb00a
12 changed files with 25 additions and 34 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
import { ProviderInterface } from '@polkadot/api-provider/types';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { BehaviorSubject } from 'rxjs';
export default function connected (provider: ProviderInterface): BehaviorSubject<boolean> {
const subject = new BehaviorSubject(provider.isConnected());
+1 -1
View File
@@ -5,7 +5,7 @@
import { ProviderInterface } from '@polkadot/api-provider/types';
import { RxApiInterface } from '../types';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { BehaviorSubject } from 'rxjs';
import createConnected from './connected';
+1 -1
View File
@@ -4,7 +4,7 @@
import { ApiInterface$Section } from '@polkadot/api/types';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { BehaviorSubject } from 'rxjs';
type CachedMap = {
[index: string]: {
+5 -7
View File
@@ -4,9 +4,7 @@
import { ApiInterface$Section } from '@polkadot/api/types';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { fromPromise } from 'rxjs/observable/fromPromise';
import { BehaviorSubject, Observable, from } from 'rxjs';
import isFunction from '@polkadot/util/is/function';
import cached from './cached';
@@ -17,9 +15,9 @@ export default function observable (subName: string, name: string, section: ApiI
}
return (...params: Array<any>): Observable<any> =>
fromPromise(
section[name].apply(null, params).catch((error: Error) =>
console.error(error)
)
from(
section[name].apply(null, params).catch(() => {
// swallow error - mostly storage failures, undefined as result
})
);
}
+1 -3
View File
@@ -4,9 +4,7 @@
import { ApiInterface$Section } from '@polkadot/api/types';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { Subscriber } from 'rxjs/Subscriber';
import { BehaviorSubject, Observable, Subscriber } from 'rxjs';
export default function subscription (name: string, params: Array<any>, section: ApiInterface$Section, unsubCallback?: () => void): BehaviorSubject<any> {
const subject = new BehaviorSubject(undefined);
+1 -2
View File
@@ -3,8 +3,7 @@
// of the ISC license. See the LICENSE file for details.
import { Interfaces } from '@polkadot/jsonrpc/types';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { BehaviorSubject, Observable } from 'rxjs';
import { Interface$Sections } from '@polkadot/jsonrpc/types';
export type RxApiInterface$Method = (...params: Array<any>) => Observable<any> | BehaviorSubject<any>;