12345678910111213141516171819202122232425262728293031 |
- const SockJS = require('sockjs-client/dist/sockjs');
- const safeThis = require('./utils/safeThis');
- function SockJSClient(url) {
- this.socket = new SockJS(url);
- }
- SockJSClient.prototype.onClose = function onClose(fn) {
- this.socket.onclose = fn;
- };
- SockJSClient.prototype.onMessage = function onMessage(fn) {
- this.socket.onmessage = function onMessageHandler(event) {
- fn(event.data);
- };
- };
- safeThis.__webpack_dev_server_client__ = SockJSClient;
|