source: trip-planner-front/node_modules/sockjs-client/lib/facade.js@ 1ad8e64

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

initial commit

  • Property mode set to 100644
File size: 723 bytes
RevLine 
[6a3a178]1'use strict';
2
3var JSON3 = require('json3')
4 , iframeUtils = require('./utils/iframe')
5 ;
6
7function FacadeJS(transport) {
8 this._transport = transport;
9 transport.on('message', this._transportMessage.bind(this));
10 transport.on('close', this._transportClose.bind(this));
11}
12
13FacadeJS.prototype._transportClose = function(code, reason) {
14 iframeUtils.postMessage('c', JSON3.stringify([code, reason]));
15};
16FacadeJS.prototype._transportMessage = function(frame) {
17 iframeUtils.postMessage('t', frame);
18};
19FacadeJS.prototype._send = function(data) {
20 this._transport.send(data);
21};
22FacadeJS.prototype._close = function() {
23 this._transport.close();
24 this._transport.removeAllListeners();
25};
26
27module.exports = FacadeJS;
Note: See TracBrowser for help on using the repository browser.