beam-interactive-node
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
exports.UnexpectedServerResponse = exports.AssertionError = exports.UnknownPacketError = exports.FatalCodingError = exports.CodingError = undefined; | ||
exports.PingTimeoutError = exports.UnexpectedServerResponse = exports.AssertionError = exports.UnknownPacketError = exports.FatalCodingError = exports.CodingError = undefined; | ||
@@ -15,10 +15,10 @@ var _lodash = require('lodash.assignin'); | ||
function extendError(name, methods) { | ||
/* eslint-disable no-new-func */ | ||
var Err = new Function('\n return function ' + name + '(message) {\n const err = new Error(message);\n this.stack = err.stack;\n this.message = err.message;\n if (this.constructor) {\n this.constructor.apply(this, arguments);\n }\n };\n ')(); | ||
/* eslint-enable */ | ||
/* eslint-disable no-new-func */ | ||
var Err = new Function('\n return function ' + name + '(message) {\n const err = new Error(message);\n this.stack = err.stack;\n this.message = err.message;\n if (this.constructor) {\n this.constructor.apply(this, arguments);\n }\n };\n ')(); | ||
/* eslint-enable */ | ||
Err.prototype = Object.create(Error.prototype); | ||
(0, _lodash2.default)(Err.prototype, methods); | ||
Err.prototype = Object.create(Error.prototype); | ||
(0, _lodash2.default)(Err.prototype, methods); | ||
return Err; | ||
return Err; | ||
} | ||
@@ -41,6 +41,6 @@ | ||
var UnknownPacketError = exports.UnknownPacketError = extendError('UnknownPacketError', { | ||
constructor: function constructor(id, data) { | ||
this.message = 'Unknown packet ID ' + id; | ||
this.data = data; | ||
} | ||
constructor: function constructor(id, data) { | ||
this.message = 'Unknown packet ID ' + id; | ||
this.data = data; | ||
} | ||
}); | ||
@@ -58,2 +58,8 @@ | ||
*/ | ||
var UnexpectedServerResponse = exports.UnexpectedServerResponse = extendError('UnexpectedServerResponse'); | ||
var UnexpectedServerResponse = exports.UnexpectedServerResponse = extendError('UnexpectedServerResponse'); | ||
/** | ||
* Emitted on sockets if a ping frame is sent without a pong message | ||
* being returned after a certain interval. | ||
*/ | ||
var PingTimeoutError = exports.PingTimeoutError = extendError('PingTimeoutError'); |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -9,2 +9,4 @@ 'use strict'; | ||
var _errors = require('./errors'); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -88,3 +90,4 @@ | ||
}, this._interval), setTimeout(function () { | ||
return _this2._socket.close(); | ||
_this2._socket.emit('error', new _errors.PingTimeoutError()); | ||
_this2._socket.close(); | ||
}, this._interval + this._timeout)]; | ||
@@ -91,0 +94,0 @@ } |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
exports.Robot = require('./dist/robot').default; | ||
exports.Frontend = require('./dist/frontend').default; |
@@ -0,0 +0,0 @@ import { EventEmitter } from 'events'; |
@@ -0,0 +0,0 @@ import { UnknownPacketError, UnexpectedServerResponse } from './errors'; |
@@ -55,1 +55,7 @@ import assignIn from 'lodash.assignin'; | ||
export const UnexpectedServerResponse = extendError('UnexpectedServerResponse'); | ||
/** | ||
* Emitted on sockets if a ping frame is sent without a pong message | ||
* being returned after a certain interval. | ||
*/ | ||
export const PingTimeoutError = extendError('PingTimeoutError'); |
@@ -0,0 +0,0 @@ import Heartbeats from '../heartbeats'; |
@@ -0,0 +0,0 @@ import Packets from './packets'; |
@@ -0,0 +0,0 @@ import { FatalCodingError, UnknownPacketError } from '../errors'; |
@@ -0,0 +0,0 @@ import Packets from './packets'; |
@@ -0,1 +1,3 @@ | ||
import { PingTimeoutError } from './errors'; | ||
export default class Heartbeat { | ||
@@ -51,3 +53,6 @@ | ||
setTimeout(() => this._ping(), this._interval), | ||
setTimeout(() => this._socket.close(), this._interval + this._timeout), | ||
setTimeout(() => { | ||
this._socket.emit('error', new PingTimeoutError()); | ||
this._socket.close(); | ||
}, this._interval + this._timeout), | ||
]; | ||
@@ -54,0 +59,0 @@ } |
@@ -0,0 +0,0 @@ import Heartbeats from '../heartbeats'; |
@@ -0,0 +0,0 @@ import Packets from './packets'; |
@@ -0,0 +0,0 @@ import { FatalCodingError, UnknownPacketError } from '../errors'; |
@@ -0,0 +0,0 @@ // Importing this is DEPRECATED and will be removed in the future. |
@@ -0,0 +0,0 @@ // window will be undefined in node.js |
@@ -0,0 +0,0 @@ import { AssertionError } from './errors'; |
{ | ||
"name": "beam-interactive-node", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "This repository contains reference a implementation of a Beam Interactive robot.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,0 +0,0 @@ # beam-interactive-node [![Build Status](https://travis-ci.org/WatchBeam/beam-interactive-node.svg)](https://travis-ci.org/WatchBeam/beam-interactive-node) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
292446
54
2768