@eleven-am/pondsocket-client 0.0.27 → 0.0.28
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/browser/client.js +2 -1
- package/browser/client.test.js +2 -5
- package/index.js +3 -6
- package/node/node.js +4 -6
- package/package.json +1 -1
package/browser/client.js
CHANGED
|
@@ -12,6 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
};
|
|
13
13
|
var _PondClient_instances, _PondClient_channels, _PondClient_createPublisher, _PondClient_handleAcknowledge, _PondClient_init;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PondClient = void 0;
|
|
15
16
|
const pondsocket_common_1 = require("@eleven-am/pondsocket-common");
|
|
16
17
|
const channel_1 = require("../core/channel");
|
|
17
18
|
class PondClient {
|
|
@@ -101,6 +102,7 @@ class PondClient {
|
|
|
101
102
|
return this._connectionState.subscribe(callback);
|
|
102
103
|
}
|
|
103
104
|
}
|
|
105
|
+
exports.PondClient = PondClient;
|
|
104
106
|
_PondClient_channels = new WeakMap(), _PondClient_instances = new WeakSet(), _PondClient_createPublisher = function _PondClient_createPublisher() {
|
|
105
107
|
return (message) => {
|
|
106
108
|
if (this._connectionState.value) {
|
|
@@ -122,4 +124,3 @@ _PondClient_channels = new WeakMap(), _PondClient_instances = new WeakSet(), _Po
|
|
|
122
124
|
}
|
|
123
125
|
});
|
|
124
126
|
};
|
|
125
|
-
exports.default = PondClient;
|
package/browser/client.test.js
CHANGED
|
@@ -8,12 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
const pondsocket_common_1 = require("@eleven-am/pondsocket-common");
|
|
16
|
-
const client_1 =
|
|
13
|
+
const client_1 = require("./client");
|
|
17
14
|
class MockWebSocket {
|
|
18
15
|
// eslint-disable-next-line no-useless-constructor
|
|
19
16
|
constructor(url) {
|
|
@@ -28,7 +25,7 @@ global.WebSocket = MockWebSocket;
|
|
|
28
25
|
describe('PondClient', () => {
|
|
29
26
|
let pondClient;
|
|
30
27
|
beforeEach(() => {
|
|
31
|
-
pondClient = new client_1.
|
|
28
|
+
pondClient = new client_1.PondClient('ws://example.com');
|
|
32
29
|
});
|
|
33
30
|
afterEach(() => {
|
|
34
31
|
jest.clearAllMocks();
|
package/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ChannelState = void 0;
|
|
7
|
-
const client_1 = __importDefault(require("./browser/client"));
|
|
8
|
-
const node_1 = __importDefault(require("./node/node"));
|
|
9
4
|
const pondsocket_common_1 = require("@eleven-am/pondsocket-common");
|
|
10
5
|
Object.defineProperty(exports, "ChannelState", { enumerable: true, get: function () { return pondsocket_common_1.ChannelState; } });
|
|
11
|
-
|
|
6
|
+
const client_1 = require("./browser/client");
|
|
7
|
+
const node_1 = require("./node/node");
|
|
8
|
+
exports.default = typeof window === 'undefined' ? node_1.PondClient : client_1.PondClient;
|
package/node/node.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
3
|
+
exports.PondClient = void 0;
|
|
4
|
+
const client_1 = require("../browser/client");
|
|
7
5
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-require-imports
|
|
8
6
|
const WebSocket = require('websocket').w3cwebsocket;
|
|
9
|
-
class PondClient extends client_1.
|
|
7
|
+
class PondClient extends client_1.PondClient {
|
|
10
8
|
/**
|
|
11
9
|
* @desc Connects to the server and returns the socket.
|
|
12
10
|
*/
|
|
@@ -30,4 +28,4 @@ class PondClient extends client_1.default {
|
|
|
30
28
|
};
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
|
-
exports.
|
|
31
|
+
exports.PondClient = PondClient;
|