source: trip-planner-front/node_modules/webpack-dev-server/client/clients/SockJSClient.js@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 4.1 KB
Line 
1'use strict';
2/* eslint-disable
3 no-unused-vars
4*/
5
6function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
7
8function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
10function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
12function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
13
14function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
15
16function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
17
18function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
19
20function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
21
22function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
23
24function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
25
26function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
27
28var SockJS = require('sockjs-client/dist/sockjs');
29
30var BaseClient = require('./BaseClient');
31
32module.exports = /*#__PURE__*/function (_BaseClient) {
33 _inherits(SockJSClient, _BaseClient);
34
35 var _super = _createSuper(SockJSClient);
36
37 function SockJSClient(url) {
38 var _this;
39
40 _classCallCheck(this, SockJSClient);
41
42 _this = _super.call(this);
43 _this.sock = new SockJS(url);
44
45 _this.sock.onerror = function (err) {// TODO: use logger to log the error event once client and client-src
46 // are reorganized to have the same directory structure
47 };
48
49 return _this;
50 }
51
52 _createClass(SockJSClient, [{
53 key: "onOpen",
54 value: function onOpen(f) {
55 this.sock.onopen = f;
56 }
57 }, {
58 key: "onClose",
59 value: function onClose(f) {
60 this.sock.onclose = f;
61 } // call f with the message string as the first argument
62
63 }, {
64 key: "onMessage",
65 value: function onMessage(f) {
66 this.sock.onmessage = function (e) {
67 f(e.data);
68 };
69 }
70 }], [{
71 key: "getClientPath",
72 value: function getClientPath(options) {
73 return require.resolve('./SockJSClient');
74 }
75 }]);
76
77 return SockJSClient;
78}(BaseClient);
Note: See TracBrowser for help on using the repository browser.