Resolve first result after unsub promise (via setImmediate) (#2324)

This commit is contained in:
Jaco Greeff
2020-06-02 17:14:29 +02:00
committed by GitHub
parent daaf4654a1
commit 44cdf49b2c
14 changed files with 83 additions and 71 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-contract",
"version": "1.17.1",
"version": "1.17.2",
"description": "Interfaces for interacting with contracts and contract ABIs",
"main": "index.js",
"keywords": [
@@ -27,9 +27,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-contract#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/api": "1.17.1",
"@polkadot/rpc-core": "1.17.1",
"@polkadot/types": "1.17.1",
"@polkadot/api": "1.17.2",
"@polkadot/rpc-core": "1.17.2",
"@polkadot/types": "1.17.2",
"@polkadot/util": "^2.12.2",
"bn.js": "^5.1.2",
"rxjs": "^6.5.5"
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "1.17.1",
"version": "1.17.2",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
@@ -28,10 +28,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/api": "1.17.1",
"@polkadot/rpc-core": "1.17.1",
"@polkadot/rpc-provider": "1.17.1",
"@polkadot/types": "1.17.1",
"@polkadot/api": "1.17.2",
"@polkadot/rpc-core": "1.17.2",
"@polkadot/rpc-provider": "1.17.2",
"@polkadot/types": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"bn.js": "^5.1.2",
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api",
"version": "1.17.1",
"version": "1.17.2",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
@@ -27,13 +27,13 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/api-derive": "1.17.1",
"@polkadot/api-derive": "1.17.2",
"@polkadot/keyring": "^2.12.2",
"@polkadot/metadata": "1.17.1",
"@polkadot/rpc-core": "1.17.1",
"@polkadot/rpc-provider": "1.17.1",
"@polkadot/types": "1.17.1",
"@polkadot/types-known": "1.17.1",
"@polkadot/metadata": "1.17.2",
"@polkadot/rpc-core": "1.17.2",
"@polkadot/rpc-provider": "1.17.2",
"@polkadot/types": "1.17.2",
"@polkadot/types-known": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"bn.js": "^5.1.2",
+9 -1
View File
@@ -84,7 +84,15 @@ export function decorateMethod<Method extends AnyFunction> (method: Method, opti
// upon the first result, resolve with the unsub function
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return
tap(() => tracker.resolve(() => subscription.unsubscribe()))
).subscribe(callback);
).subscribe((result: any): void => {
if (setImmediate) {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
setImmediate(() => callback(result) as void);
} else {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
callback(result);
}
});
}) as UnsubscribePromise;
} as StorageEntryPromiseOverloads;
}
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/metadata",
"version": "1.17.1",
"version": "1.17.2",
"description": "Helpers to extract information from runtime metadata",
"main": "index.js",
"publishConfig": {
@@ -27,8 +27,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-metadata#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/types": "1.17.1",
"@polkadot/types-known": "1.17.1",
"@polkadot/types": "1.17.2",
"@polkadot/types-known": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"bn.js": "^5.1.2"
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "1.17.1",
"version": "1.17.2",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -27,9 +27,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/metadata": "1.17.1",
"@polkadot/rpc-provider": "1.17.1",
"@polkadot/types": "1.17.1",
"@polkadot/metadata": "1.17.2",
"@polkadot/rpc-provider": "1.17.2",
"@polkadot/types": "1.17.2",
"@polkadot/util": "^2.12.2",
"memoizee": "^0.4.14",
"rxjs": "^6.5.5"
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "1.17.1",
"version": "1.17.2",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -27,8 +27,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/metadata": "1.17.1",
"@polkadot/types": "1.17.1",
"@polkadot/metadata": "1.17.2",
"@polkadot/types": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"bn.js": "^5.1.2",
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/typegen",
"version": "1.17.1",
"version": "1.17.2",
"description": "Type generation scripts",
"main": "index.js",
"bin": {
@@ -36,10 +36,10 @@
"@babel/core": "^7.10.2",
"@babel/register": "^7.10.1",
"@babel/runtime": "^7.10.2",
"@polkadot/api": "1.17.1",
"@polkadot/metadata": "1.17.1",
"@polkadot/rpc-provider": "1.17.1",
"@polkadot/types": "1.17.1",
"@polkadot/api": "1.17.2",
"@polkadot/metadata": "1.17.2",
"@polkadot/rpc-provider": "1.17.2",
"@polkadot/types": "1.17.2",
"@polkadot/util": "^2.12.2",
"handlebars": "^4.7.6",
"websocket": "^1.0.31",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types-known",
"version": "1.17.1",
"version": "1.17.2",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -27,7 +27,7 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types-known#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/types": "1.17.1",
"@polkadot/types": "1.17.2",
"@polkadot/util": "^2.12.2",
"bn.js": "^5.1.2"
},
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "1.17.1",
"version": "1.17.2",
"description": "Implementation of the Parity codec",
"main": "index.js",
"keywords": [
@@ -27,7 +27,7 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.10.2",
"@polkadot/metadata": "1.17.1",
"@polkadot/metadata": "1.17.2",
"@polkadot/util": "^2.12.2",
"@polkadot/util-crypto": "^2.12.2",
"@types/bn.js": "^4.11.6",