Bump dependencies
This commit is contained in:
@@ -10,7 +10,8 @@ type Cached$ParamJson = string;
|
||||
|
||||
type CachedMap = {
|
||||
[Cached$Name]: {
|
||||
[Cached$ParamJson]: rxjs$BehaviorSubject<*>
|
||||
// flowlint-next-line unclear-type:off
|
||||
[Cached$ParamJson]: rxjs$BehaviorSubject<any>
|
||||
}
|
||||
};
|
||||
|
||||
@@ -18,12 +19,14 @@ const subject = require('./subject');
|
||||
|
||||
const cacheMap: CachedMap = {};
|
||||
|
||||
module.exports = function cached (subName: string, name: string, section: ApiInterface$Section): (...params: Array<mixed>) => rxjs$BehaviorSubject<*> {
|
||||
// flowlint-next-line unclear-type:off
|
||||
module.exports = function cached (subName: string, name: string, section: ApiInterface$Section): (...params: Array<mixed>) => rxjs$BehaviorSubject<any> {
|
||||
if (!cacheMap[subName]) {
|
||||
cacheMap[subName] = {};
|
||||
}
|
||||
|
||||
return (...params: Array<mixed>): rxjs$BehaviorSubject<*> => {
|
||||
// flowlint-next-line unclear-type:off
|
||||
return (...params: Array<mixed>): rxjs$BehaviorSubject<any> => {
|
||||
const paramStr = JSON.stringify(params);
|
||||
|
||||
if (!cacheMap[subName][paramStr]) {
|
||||
|
||||
@@ -10,12 +10,14 @@ const isFunction = require('@polkadot/util/is/function');
|
||||
|
||||
const cached = require('./cached');
|
||||
|
||||
module.exports = function observable (subName: string, name: string, section: ApiInterface$Section): (...params: Array<mixed>) => rxjs$Observable<*> | rxjs$BehaviorSubject<*> {
|
||||
// flowlint-next-line unclear-type:off
|
||||
module.exports = function observable (subName: string, name: string, section: ApiInterface$Section): (...params: Array<mixed>) => rxjs$Observable<any> | rxjs$BehaviorSubject<any> {
|
||||
if (isFunction(section[name].unsubscribe)) {
|
||||
return cached(subName, name, section);
|
||||
}
|
||||
|
||||
return (...params: Array<mixed>): rxjs$Observable<*> =>
|
||||
// flowlint-next-line unclear-type:off
|
||||
return (...params: Array<mixed>): rxjs$Observable<any> =>
|
||||
fromPromise(
|
||||
section[name].apply(null, params)
|
||||
);
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
import type { InterfaceTypes } from '@polkadot/api-jsonrpc/types';
|
||||
|
||||
export type RxApiInterface$Method = (...params: Array<mixed>) => rxjs$Observable<*> | rxjs$BehaviorSubject<*>;
|
||||
// flowlint-next-line unclear-type:off
|
||||
export type RxApiInterface$Method = (...params: Array<mixed>) => rxjs$Observable<any> | rxjs$BehaviorSubject<any>;
|
||||
|
||||
export type RxApiInterface$Section = {
|
||||
[string]: RxApiInterface$Method
|
||||
|
||||
Reference in New Issue
Block a user