@metamask-previews/connectivity-controller 0.2.0-preview-ac7a6cc51 → 0.2.0-preview-373edc9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/selectors.cjs +28 -0
- package/dist/selectors.cjs.map +1 -0
- package/dist/selectors.d.cts +31 -0
- package/dist/selectors.d.cts.map +1 -0
- package/dist/selectors.d.mts +31 -0
- package/dist/selectors.d.mts.map +1 -0
- package/dist/selectors.mjs +25 -0
- package/dist/selectors.mjs.map +1 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Add `connectivityControllerSelectors` with `selectConnectivityStatus` and `selectIsOffline` selectors ([#7701](https://github.com/MetaMask/core/pull/7701))
|
|
13
|
+
- `selectConnectivityStatus` returns the current connectivity status from the controller state
|
|
14
|
+
- `selectIsOffline` is a memoized selector that returns `true` when the device is offline
|
|
15
|
+
|
|
10
16
|
## [0.2.0]
|
|
11
17
|
|
|
12
18
|
### Added
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultConnectivityControllerState = exports.ConnectivityController = exports.CONNECTIVITY_STATUSES = void 0;
|
|
3
|
+
exports.connectivityControllerSelectors = exports.getDefaultConnectivityControllerState = exports.ConnectivityController = exports.CONNECTIVITY_STATUSES = void 0;
|
|
4
4
|
var types_1 = require("./types.cjs");
|
|
5
5
|
Object.defineProperty(exports, "CONNECTIVITY_STATUSES", { enumerable: true, get: function () { return types_1.CONNECTIVITY_STATUSES; } });
|
|
6
6
|
var ConnectivityController_1 = require("./ConnectivityController.cjs");
|
|
7
7
|
Object.defineProperty(exports, "ConnectivityController", { enumerable: true, get: function () { return ConnectivityController_1.ConnectivityController; } });
|
|
8
8
|
Object.defineProperty(exports, "getDefaultConnectivityControllerState", { enumerable: true, get: function () { return ConnectivityController_1.getDefaultConnectivityControllerState; } });
|
|
9
|
+
var selectors_1 = require("./selectors.cjs");
|
|
10
|
+
Object.defineProperty(exports, "connectivityControllerSelectors", { enumerable: true, get: function () { return selectors_1.connectivityControllerSelectors; } });
|
|
9
11
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAUA,qCAAgD;AAAvC,8GAAA,qBAAqB,OAAA;AAC9B,uEAGkC;AAFhC,gIAAA,sBAAsB,OAAA;AACtB,+IAAA,qCAAqC,OAAA","sourcesContent":["export type {\n ConnectivityControllerState,\n ConnectivityControllerGetStateAction,\n ConnectivityControllerActions,\n ConnectivityControllerStateChangeEvent,\n ConnectivityControllerEvents,\n ConnectivityControllerMessenger,\n} from './ConnectivityController';\nexport type { ConnectivityControllerSetConnectivityStatusAction } from './ConnectivityController-method-action-types';\nexport type { ConnectivityAdapter, ConnectivityStatus } from './types';\nexport { CONNECTIVITY_STATUSES } from './types';\nexport {\n ConnectivityController,\n getDefaultConnectivityControllerState,\n} from './ConnectivityController';\n"]}
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAUA,qCAAgD;AAAvC,8GAAA,qBAAqB,OAAA;AAC9B,uEAGkC;AAFhC,gIAAA,sBAAsB,OAAA;AACtB,+IAAA,qCAAqC,OAAA;AAEvC,6CAA8D;AAArD,4HAAA,+BAA+B,OAAA","sourcesContent":["export type {\n ConnectivityControllerState,\n ConnectivityControllerGetStateAction,\n ConnectivityControllerActions,\n ConnectivityControllerStateChangeEvent,\n ConnectivityControllerEvents,\n ConnectivityControllerMessenger,\n} from './ConnectivityController';\nexport type { ConnectivityControllerSetConnectivityStatusAction } from './ConnectivityController-method-action-types';\nexport type { ConnectivityAdapter, ConnectivityStatus } from './types';\nexport { CONNECTIVITY_STATUSES } from './types';\nexport {\n ConnectivityController,\n getDefaultConnectivityControllerState,\n} from './ConnectivityController';\nexport { connectivityControllerSelectors } from './selectors';\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -3,4 +3,5 @@ export type { ConnectivityControllerSetConnectivityStatusAction } from "./Connec
|
|
|
3
3
|
export type { ConnectivityAdapter, ConnectivityStatus } from "./types.cjs";
|
|
4
4
|
export { CONNECTIVITY_STATUSES } from "./types.cjs";
|
|
5
5
|
export { ConnectivityController, getDefaultConnectivityControllerState, } from "./ConnectivityController.cjs";
|
|
6
|
+
export { connectivityControllerSelectors } from "./selectors.cjs";
|
|
6
7
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,2BAA2B,EAC3B,oCAAoC,EACpC,6BAA6B,EAC7B,sCAAsC,EACtC,4BAA4B,EAC5B,+BAA+B,GAChC,qCAAiC;AAClC,YAAY,EAAE,iDAAiD,EAAE,yDAAqD;AACtH,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAgB;AACvE,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAChD,OAAO,EACL,sBAAsB,EACtB,qCAAqC,GACtC,qCAAiC"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,2BAA2B,EAC3B,oCAAoC,EACpC,6BAA6B,EAC7B,sCAAsC,EACtC,4BAA4B,EAC5B,+BAA+B,GAChC,qCAAiC;AAClC,YAAY,EAAE,iDAAiD,EAAE,yDAAqD;AACtH,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAgB;AACvE,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAChD,OAAO,EACL,sBAAsB,EACtB,qCAAqC,GACtC,qCAAiC;AAClC,OAAO,EAAE,+BAA+B,EAAE,wBAAoB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -3,4 +3,5 @@ export type { ConnectivityControllerSetConnectivityStatusAction } from "./Connec
|
|
|
3
3
|
export type { ConnectivityAdapter, ConnectivityStatus } from "./types.mjs";
|
|
4
4
|
export { CONNECTIVITY_STATUSES } from "./types.mjs";
|
|
5
5
|
export { ConnectivityController, getDefaultConnectivityControllerState, } from "./ConnectivityController.mjs";
|
|
6
|
+
export { connectivityControllerSelectors } from "./selectors.mjs";
|
|
6
7
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,2BAA2B,EAC3B,oCAAoC,EACpC,6BAA6B,EAC7B,sCAAsC,EACtC,4BAA4B,EAC5B,+BAA+B,GAChC,qCAAiC;AAClC,YAAY,EAAE,iDAAiD,EAAE,yDAAqD;AACtH,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAgB;AACvE,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAChD,OAAO,EACL,sBAAsB,EACtB,qCAAqC,GACtC,qCAAiC"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,2BAA2B,EAC3B,oCAAoC,EACpC,6BAA6B,EAC7B,sCAAsC,EACtC,4BAA4B,EAC5B,+BAA+B,GAChC,qCAAiC;AAClC,YAAY,EAAE,iDAAiD,EAAE,yDAAqD;AACtH,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAgB;AACvE,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAChD,OAAO,EACL,sBAAsB,EACtB,qCAAqC,GACtC,qCAAiC;AAClC,OAAO,EAAE,+BAA+B,EAAE,wBAAoB"}
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAChD,OAAO,EACL,sBAAsB,EACtB,qCAAqC,EACtC,qCAAiC","sourcesContent":["export type {\n ConnectivityControllerState,\n ConnectivityControllerGetStateAction,\n ConnectivityControllerActions,\n ConnectivityControllerStateChangeEvent,\n ConnectivityControllerEvents,\n ConnectivityControllerMessenger,\n} from './ConnectivityController';\nexport type { ConnectivityControllerSetConnectivityStatusAction } from './ConnectivityController-method-action-types';\nexport type { ConnectivityAdapter, ConnectivityStatus } from './types';\nexport { CONNECTIVITY_STATUSES } from './types';\nexport {\n ConnectivityController,\n getDefaultConnectivityControllerState,\n} from './ConnectivityController';\n"]}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAChD,OAAO,EACL,sBAAsB,EACtB,qCAAqC,EACtC,qCAAiC;AAClC,OAAO,EAAE,+BAA+B,EAAE,wBAAoB","sourcesContent":["export type {\n ConnectivityControllerState,\n ConnectivityControllerGetStateAction,\n ConnectivityControllerActions,\n ConnectivityControllerStateChangeEvent,\n ConnectivityControllerEvents,\n ConnectivityControllerMessenger,\n} from './ConnectivityController';\nexport type { ConnectivityControllerSetConnectivityStatusAction } from './ConnectivityController-method-action-types';\nexport type { ConnectivityAdapter, ConnectivityStatus } from './types';\nexport { CONNECTIVITY_STATUSES } from './types';\nexport {\n ConnectivityController,\n getDefaultConnectivityControllerState,\n} from './ConnectivityController';\nexport { connectivityControllerSelectors } from './selectors';\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connectivityControllerSelectors = void 0;
|
|
4
|
+
const reselect_1 = require("reselect");
|
|
5
|
+
const types_1 = require("./types.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Selects the connectivity status from the controller state.
|
|
8
|
+
*
|
|
9
|
+
* @param state - The controller state
|
|
10
|
+
* @returns The connectivity status
|
|
11
|
+
*/
|
|
12
|
+
const selectConnectivityStatus = (state) => state.connectivityStatus;
|
|
13
|
+
/**
|
|
14
|
+
* Selects whether the device is offline.
|
|
15
|
+
*
|
|
16
|
+
* @param state - The controller state
|
|
17
|
+
* @returns Whether the device is offline
|
|
18
|
+
*/
|
|
19
|
+
const selectIsOffline = (0, reselect_1.createSelector)([selectConnectivityStatus], (connectivityStatus) => connectivityStatus === types_1.CONNECTIVITY_STATUSES.Offline);
|
|
20
|
+
/**
|
|
21
|
+
* Selectors for the ConnectivityController state.
|
|
22
|
+
* These can be used with Redux or directly with controller state.
|
|
23
|
+
*/
|
|
24
|
+
exports.connectivityControllerSelectors = {
|
|
25
|
+
selectConnectivityStatus,
|
|
26
|
+
selectIsOffline,
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=selectors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.cjs","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":";;;AAAA,uCAA0C;AAG1C,uCAAgD;AAGhD;;;;;GAKG;AACH,MAAM,wBAAwB,GAAG,CAC/B,KAAkC,EACd,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,eAAe,GAAG,IAAA,yBAAc,EACpC,CAAC,wBAAwB,CAAC,EAC1B,CAAC,kBAAkB,EAAE,EAAE,CAAC,kBAAkB,KAAK,6BAAqB,CAAC,OAAO,CAC7E,CAAC;AAEF;;;GAGG;AACU,QAAA,+BAA+B,GAAG;IAC7C,wBAAwB;IACxB,eAAe;CAChB,CAAC","sourcesContent":["import { createSelector } from 'reselect';\n\nimport type { ConnectivityControllerState } from './ConnectivityController';\nimport { CONNECTIVITY_STATUSES } from './types';\nimport type { ConnectivityStatus } from './types';\n\n/**\n * Selects the connectivity status from the controller state.\n *\n * @param state - The controller state\n * @returns The connectivity status\n */\nconst selectConnectivityStatus = (\n state: ConnectivityControllerState,\n): ConnectivityStatus => state.connectivityStatus;\n\n/**\n * Selects whether the device is offline.\n *\n * @param state - The controller state\n * @returns Whether the device is offline\n */\nconst selectIsOffline = createSelector(\n [selectConnectivityStatus],\n (connectivityStatus) => connectivityStatus === CONNECTIVITY_STATUSES.Offline,\n);\n\n/**\n * Selectors for the ConnectivityController state.\n * These can be used with Redux or directly with controller state.\n */\nexport const connectivityControllerSelectors = {\n selectConnectivityStatus,\n selectIsOffline,\n};\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ConnectivityControllerState } from "./ConnectivityController.cjs";
|
|
2
|
+
import type { ConnectivityStatus } from "./types.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Selectors for the ConnectivityController state.
|
|
5
|
+
* These can be used with Redux or directly with controller state.
|
|
6
|
+
*/
|
|
7
|
+
export declare const connectivityControllerSelectors: {
|
|
8
|
+
selectConnectivityStatus: (state: ConnectivityControllerState) => ConnectivityStatus;
|
|
9
|
+
selectIsOffline: ((state: ConnectivityControllerState) => boolean) & {
|
|
10
|
+
clearCache: () => void;
|
|
11
|
+
resultsCount: () => number;
|
|
12
|
+
resetResultsCount: () => void;
|
|
13
|
+
} & {
|
|
14
|
+
resultFunc: (resultFuncArgs_0: ConnectivityStatus) => boolean;
|
|
15
|
+
memoizedResultFunc: ((resultFuncArgs_0: ConnectivityStatus) => boolean) & {
|
|
16
|
+
clearCache: () => void;
|
|
17
|
+
resultsCount: () => number;
|
|
18
|
+
resetResultsCount: () => void;
|
|
19
|
+
};
|
|
20
|
+
lastResult: () => boolean;
|
|
21
|
+
dependencies: [(state: ConnectivityControllerState) => ConnectivityStatus];
|
|
22
|
+
recomputations: () => number;
|
|
23
|
+
resetRecomputations: () => void;
|
|
24
|
+
dependencyRecomputations: () => number;
|
|
25
|
+
resetDependencyRecomputations: () => void;
|
|
26
|
+
} & {
|
|
27
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
28
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=selectors.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.cts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,qCAAiC;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAgB;AAuBlD;;;GAGG;AACH,eAAO,MAAM,+BAA+B;sCAlBnC,2BAA2B,KACjC,kBAAkB;;;;;;;;;;;;;+BADZ,2BAA2B,KACjC,kBAAkB;;;;;;;;;CAoBpB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ConnectivityControllerState } from "./ConnectivityController.mjs";
|
|
2
|
+
import type { ConnectivityStatus } from "./types.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Selectors for the ConnectivityController state.
|
|
5
|
+
* These can be used with Redux or directly with controller state.
|
|
6
|
+
*/
|
|
7
|
+
export declare const connectivityControllerSelectors: {
|
|
8
|
+
selectConnectivityStatus: (state: ConnectivityControllerState) => ConnectivityStatus;
|
|
9
|
+
selectIsOffline: ((state: ConnectivityControllerState) => boolean) & {
|
|
10
|
+
clearCache: () => void;
|
|
11
|
+
resultsCount: () => number;
|
|
12
|
+
resetResultsCount: () => void;
|
|
13
|
+
} & {
|
|
14
|
+
resultFunc: (resultFuncArgs_0: ConnectivityStatus) => boolean;
|
|
15
|
+
memoizedResultFunc: ((resultFuncArgs_0: ConnectivityStatus) => boolean) & {
|
|
16
|
+
clearCache: () => void;
|
|
17
|
+
resultsCount: () => number;
|
|
18
|
+
resetResultsCount: () => void;
|
|
19
|
+
};
|
|
20
|
+
lastResult: () => boolean;
|
|
21
|
+
dependencies: [(state: ConnectivityControllerState) => ConnectivityStatus];
|
|
22
|
+
recomputations: () => number;
|
|
23
|
+
resetRecomputations: () => void;
|
|
24
|
+
dependencyRecomputations: () => number;
|
|
25
|
+
resetDependencyRecomputations: () => void;
|
|
26
|
+
} & {
|
|
27
|
+
memoize: typeof import("reselect").weakMapMemoize;
|
|
28
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=selectors.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.mts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,2BAA2B,EAAE,qCAAiC;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAgB;AAuBlD;;;GAGG;AACH,eAAO,MAAM,+BAA+B;sCAlBnC,2BAA2B,KACjC,kBAAkB;;;;;;;;;;;;;+BADZ,2BAA2B,KACjC,kBAAkB;;;;;;;;;CAoBpB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createSelector } from "reselect";
|
|
2
|
+
import { CONNECTIVITY_STATUSES } from "./types.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Selects the connectivity status from the controller state.
|
|
5
|
+
*
|
|
6
|
+
* @param state - The controller state
|
|
7
|
+
* @returns The connectivity status
|
|
8
|
+
*/
|
|
9
|
+
const selectConnectivityStatus = (state) => state.connectivityStatus;
|
|
10
|
+
/**
|
|
11
|
+
* Selects whether the device is offline.
|
|
12
|
+
*
|
|
13
|
+
* @param state - The controller state
|
|
14
|
+
* @returns Whether the device is offline
|
|
15
|
+
*/
|
|
16
|
+
const selectIsOffline = createSelector([selectConnectivityStatus], (connectivityStatus) => connectivityStatus === CONNECTIVITY_STATUSES.Offline);
|
|
17
|
+
/**
|
|
18
|
+
* Selectors for the ConnectivityController state.
|
|
19
|
+
* These can be used with Redux or directly with controller state.
|
|
20
|
+
*/
|
|
21
|
+
export const connectivityControllerSelectors = {
|
|
22
|
+
selectConnectivityStatus,
|
|
23
|
+
selectIsOffline,
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=selectors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.mjs","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB;AAG1C,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAGhD;;;;;GAKG;AACH,MAAM,wBAAwB,GAAG,CAC/B,KAAkC,EACd,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,eAAe,GAAG,cAAc,CACpC,CAAC,wBAAwB,CAAC,EAC1B,CAAC,kBAAkB,EAAE,EAAE,CAAC,kBAAkB,KAAK,qBAAqB,CAAC,OAAO,CAC7E,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,wBAAwB;IACxB,eAAe;CAChB,CAAC","sourcesContent":["import { createSelector } from 'reselect';\n\nimport type { ConnectivityControllerState } from './ConnectivityController';\nimport { CONNECTIVITY_STATUSES } from './types';\nimport type { ConnectivityStatus } from './types';\n\n/**\n * Selects the connectivity status from the controller state.\n *\n * @param state - The controller state\n * @returns The connectivity status\n */\nconst selectConnectivityStatus = (\n state: ConnectivityControllerState,\n): ConnectivityStatus => state.connectivityStatus;\n\n/**\n * Selects whether the device is offline.\n *\n * @param state - The controller state\n * @returns Whether the device is offline\n */\nconst selectIsOffline = createSelector(\n [selectConnectivityStatus],\n (connectivityStatus) => connectivityStatus === CONNECTIVITY_STATUSES.Offline,\n);\n\n/**\n * Selectors for the ConnectivityController state.\n * These can be used with Redux or directly with controller state.\n */\nexport const connectivityControllerSelectors = {\n selectConnectivityStatus,\n selectIsOffline,\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/connectivity-controller",
|
|
3
|
-
"version": "0.2.0-preview-
|
|
3
|
+
"version": "0.2.0-preview-373edc9",
|
|
4
4
|
"description": "ConnectivityController stores the device's internet connectivity status",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -49,7 +49,8 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@metamask/base-controller": "^9.0.1",
|
|
52
|
-
"@metamask/messenger": "^1.0.0"
|
|
52
|
+
"@metamask/messenger": "^1.0.0",
|
|
53
|
+
"reselect": "^5.1.1"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"@metamask/auto-changelog": "^3.4.4",
|