Cache getTypeClass (#1183)

* Put memoizee only in types

* Add some tests

* Add failing tests

* Make instanceof work

* Better tests
This commit is contained in:
Amaury Martiny
2019-07-24 17:22:49 +02:00
committed by GitHub
parent b89e0d5522
commit 66ab3ac502
6 changed files with 88 additions and 14 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ import { RpcSection, RpcMethod } from '@polkadot/jsonrpc/types';
import { AnyJson, Codec } from '@polkadot/types/types';
import { RpcInterface, RpcInterfaceMethod, RpcInterfaceSection } from './types';
import memoize from 'memoizee';
import memoizee from 'memoizee';
import { combineLatest, from, Observable, Observer, of, throwError } from 'rxjs';
import { catchError, map, publishReplay, refCount, switchMap } from 'rxjs/operators';
import interfaces from '@polkadot/jsonrpc';
@@ -239,7 +239,7 @@ export default class Rpc implements RpcInterface {
);
};
const memoized = memoize(call, {
const memoized = memoizee(call, {
// Dynamic length for argument
length: false,
// Normalize args so that different args that should be cached