1 | var __extends = (this && this.__extends) || (function () {
|
2 | var extendStatics = function (d, b) {
|
3 | extendStatics = Object.setPrototypeOf ||
|
4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
6 | return extendStatics(d, b);
|
7 | }
|
8 | return function (d, b) {
|
9 | extendStatics(d, b);
|
10 | function __() { this.constructor = d; }
|
11 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
12 | };
|
13 | })();
|
14 | import { ApolloLink } from 'apollo-link';
|
15 | import { SubscriptionClient } from 'subscriptions-transport-ws';
|
16 | var WebSocketLink = (function (_super) {
|
17 | __extends(WebSocketLink, _super);
|
18 | function WebSocketLink(paramsOrClient) {
|
19 | var _this = _super.call(this) || this;
|
20 | if (paramsOrClient instanceof SubscriptionClient) {
|
21 | _this.subscriptionClient = paramsOrClient;
|
22 | }
|
23 | else {
|
24 | _this.subscriptionClient = new SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl);
|
25 | }
|
26 | return _this;
|
27 | }
|
28 | WebSocketLink.prototype.request = function (operation) {
|
29 | return this.subscriptionClient.request(operation);
|
30 | };
|
31 | return WebSocketLink;
|
32 | }(ApolloLink));
|
33 | export { WebSocketLink };
|
34 |
|
\ | No newline at end of file |