Derive drr doesn't have delay (#1548)
This commit is contained in:
@@ -32,6 +32,6 @@
|
||||
"@polkadot/types": "^0.96.0-beta.32"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^1.7.0-beta.2"
|
||||
"@polkadot/keyring": "^1.7.0-beta.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// Copyright 2017-2019 @polkadot/api-derive authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { drr as drrBase, DrrResult } from '@polkadot/rpc-core/rxjs';
|
||||
|
||||
export const drr = (): DrrResult =>
|
||||
drrBase({ skipTimeout: true });
|
||||
@@ -2,7 +2,6 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
export { drr } from '@polkadot/rpc-core/rxjs';
|
||||
|
||||
export * from './approvalFlagsToBools';
|
||||
export * from './drr';
|
||||
export * from './memo';
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.3",
|
||||
"@polkadot/types": "^0.96.0-beta.32",
|
||||
"@polkadot/util": "^1.7.0-beta.2",
|
||||
"@polkadot/util-crypto": "^1.7.0-beta.2"
|
||||
"@polkadot/util": "^1.7.0-beta.4",
|
||||
"@polkadot/util-crypto": "^1.7.0-beta.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^1.7.0-beta.2"
|
||||
"@polkadot/keyring": "^1.7.0-beta.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
"@babel/runtime": "^7.6.3",
|
||||
"@polkadot/api-derive": "^0.96.0-beta.32",
|
||||
"@polkadot/api-metadata": "^0.96.0-beta.32",
|
||||
"@polkadot/keyring": "^1.7.0-beta.2",
|
||||
"@polkadot/keyring": "^1.7.0-beta.4",
|
||||
"@polkadot/rpc-core": "^0.96.0-beta.32",
|
||||
"@polkadot/rpc-provider": "^0.96.0-beta.32",
|
||||
"@polkadot/types": "^0.96.0-beta.32",
|
||||
"@polkadot/util-crypto": "^1.7.0-beta.2"
|
||||
"@polkadot/util-crypto": "^1.7.0-beta.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^1.7.0-beta.2"
|
||||
"@polkadot/keyring": "^1.7.0-beta.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"@polkadot/jsonrpc": "^0.96.0-beta.32",
|
||||
"@polkadot/rpc-provider": "^0.96.0-beta.32",
|
||||
"@polkadot/types": "^0.96.0-beta.32",
|
||||
"@polkadot/util": "^1.7.0-beta.2",
|
||||
"@polkadot/util": "^1.7.0-beta.4",
|
||||
"rxjs": "^6.5.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,17 @@
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { catchError, distinctUntilChanged, publishReplay, tap } from 'rxjs/operators';
|
||||
import { catchError, distinctUntilChanged, publishReplay, tap, refCount } from 'rxjs/operators';
|
||||
import { logger } from '@polkadot/util';
|
||||
|
||||
import { refCountDelay } from './refCountDelay';
|
||||
|
||||
type DrrResult = <T> (source$: Observable<T>) => Observable<T>;
|
||||
export type DrrResult = <T> (source$: Observable<T>) => Observable<T>;
|
||||
|
||||
interface Options {
|
||||
skipChange?: boolean;
|
||||
skipTimeout?: boolean;
|
||||
}
|
||||
|
||||
const l = logger('drr');
|
||||
|
||||
@@ -28,12 +33,14 @@ const NOOP = (): void => {};
|
||||
*
|
||||
* @ignore
|
||||
*/
|
||||
export const drr = (skipChange?: boolean): DrrResult => <T> (source$: Observable<T>): Observable<T> =>
|
||||
export const drr = ({ skipChange, skipTimeout }: Options = {}): DrrResult => <T> (source$: Observable<T>): Observable<T> =>
|
||||
source$.pipe(
|
||||
catchError(ERR),
|
||||
skipChange
|
||||
? tap(NOOP)
|
||||
: distinctUntilChanged(CMP),
|
||||
publishReplay(1),
|
||||
refCountDelay()
|
||||
skipTimeout
|
||||
? refCount()
|
||||
: refCountDelay()
|
||||
);
|
||||
|
||||
@@ -28,15 +28,15 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.3",
|
||||
"@polkadot/api-metadata": "^0.96.0-beta.32",
|
||||
"@polkadot/util": "^1.7.0-beta.2",
|
||||
"@polkadot/util-crypto": "^1.7.0-beta.2",
|
||||
"@polkadot/util": "^1.7.0-beta.4",
|
||||
"@polkadot/util-crypto": "^1.7.0-beta.4",
|
||||
"@types/nock": "^11.1.0",
|
||||
"eventemitter3": "^4.0.0",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"websocket": "^1.0.30"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^1.7.0-beta.2",
|
||||
"@polkadot/keyring": "^1.7.0-beta.4",
|
||||
"mock-socket": "^9.0.2",
|
||||
"nock": "^11.4.0"
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.6.3",
|
||||
"@polkadot/util": "^1.7.0-beta.2",
|
||||
"@polkadot/util-crypto": "^1.7.0-beta.2",
|
||||
"@polkadot/util": "^1.7.0-beta.4",
|
||||
"@polkadot/util-crypto": "^1.7.0-beta.4",
|
||||
"@types/memoizee": "^0.4.3",
|
||||
"memoizee": "^0.4.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^1.7.0-beta.2"
|
||||
"@polkadot/keyring": "^1.7.0-beta.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1835,14 +1835,14 @@
|
||||
typescript "^3.6.4"
|
||||
vuepress "^1.2.0"
|
||||
|
||||
"@polkadot/keyring@^1.7.0-beta.2":
|
||||
version "1.7.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-1.7.0-beta.2.tgz#68bcc96670155452916ae81be57719472a9c2c8e"
|
||||
integrity sha512-gOvLdA6VDxbLhFKByT/YKklkEuhby/HHbwr6QA4nSy0kbsqO0L7j3SqudxyOMlghwbJtDy5dn1wqQ5yO6PHcOA==
|
||||
"@polkadot/keyring@^1.7.0-beta.4":
|
||||
version "1.7.0-beta.4"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-1.7.0-beta.4.tgz#a1b77555b8c2723fa4087a13957fb9520f628f3f"
|
||||
integrity sha512-BnrJ+rM/6LJuTDrsxkCLCTtlQoTSq7vOohM7gwi7d4vKTALyPuRW8cIDEaWMvr6edTnCIKtbFyDoWRhmr8eziA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.3"
|
||||
"@polkadot/util" "^1.7.0-beta.2"
|
||||
"@polkadot/util-crypto" "^1.7.0-beta.2"
|
||||
"@polkadot/util" "^1.7.0-beta.4"
|
||||
"@polkadot/util-crypto" "^1.7.0-beta.4"
|
||||
|
||||
"@polkadot/ts@^0.1.83":
|
||||
version "0.1.83"
|
||||
@@ -1851,13 +1851,13 @@
|
||||
dependencies:
|
||||
"@types/chrome" "^0.0.91"
|
||||
|
||||
"@polkadot/util-crypto@^1.7.0-beta.2":
|
||||
version "1.7.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-1.7.0-beta.2.tgz#728058f2f23664e735b62aee744747629d0d99cb"
|
||||
integrity sha512-D00TGi1FchHjylpEqlmL+3v31J14WMOvmMay8Z0Mhp3cJbMLbxBSvf7Ep8P/CwLXDZAizFhj6rcZeOYkJmzK0Q==
|
||||
"@polkadot/util-crypto@^1.7.0-beta.4":
|
||||
version "1.7.0-beta.4"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-1.7.0-beta.4.tgz#9745a58a86ef8590e72eff9593cb8b533131cc56"
|
||||
integrity sha512-UazHr5k/8+5uCUdxmmwAs7XkKBHxOj3iPVYx/ZsoFijzMzBgRyI/c8CPFHIbLgClwd7bgrXCVwjo93NJRSqI7w==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.3"
|
||||
"@polkadot/util" "^1.7.0-beta.2"
|
||||
"@polkadot/util" "^1.7.0-beta.4"
|
||||
"@polkadot/wasm-crypto" "^0.14.1"
|
||||
"@types/bip39" "^2.4.2"
|
||||
"@types/bs58" "^4.0.0"
|
||||
@@ -1873,10 +1873,10 @@
|
||||
tweetnacl "^1.0.1"
|
||||
xxhashjs "^0.2.2"
|
||||
|
||||
"@polkadot/util@^1.7.0-beta.2":
|
||||
version "1.7.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-1.7.0-beta.2.tgz#b65fc681578d55646e6cce626ed5e17b0661975d"
|
||||
integrity sha512-qG788v8HPZqOF65CDIDvYWAEVKB8Ur9gBfAtdpX1PgdSbT1kiz2ajjcJ1zY9VHg5Y8SubzfISlmzZ37RcNhpGQ==
|
||||
"@polkadot/util@^1.7.0-beta.4":
|
||||
version "1.7.0-beta.4"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-1.7.0-beta.4.tgz#e04b7f1a4b24619efd88ecce0b920c99896fdd01"
|
||||
integrity sha512-aFRfhXkb8RzVCv45xfDacKL1lkqLkIHyyoANHbbrDClq6+yxq4nw7ykTMMPj9/ff0xLgCAZzLLpMAiirVnc3SQ==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.6.3"
|
||||
"@types/bn.js" "^4.11.5"
|
||||
|
||||
Reference in New Issue
Block a user