Comparing version 0.1.10 to 0.1.11
@@ -11,2 +11,3 @@ export default interface BasicPeer { | ||
isConnected(): boolean; | ||
isDestroyed(): boolean; | ||
} | ||
@@ -13,0 +14,0 @@ export declare function createBasicPeer(initiator: boolean): BasicPeer; |
@@ -58,2 +58,5 @@ "use strict"; | ||
}; | ||
WebRTCBasicPeer.prototype.isDestroyed = function () { | ||
return this._peer.destroyed; | ||
}; | ||
WebRTCBasicPeer.prototype.isConnected = function () { | ||
@@ -153,2 +156,5 @@ return this._peer.connected; | ||
}; | ||
MockBasicPeer.prototype.isDestroyed = function () { | ||
return this.destroyed; | ||
}; | ||
MockBasicPeer.prototype.isConnected = function () { | ||
@@ -155,0 +161,0 @@ return this.connected; |
@@ -101,11 +101,13 @@ "use strict"; | ||
ws.onmessage = function (event) { | ||
var signal; | ||
try { | ||
// According to TypeScript, at least, there are a bunch of stringlike data | ||
// types we could receive here. In practice I have only seen strings. | ||
var signal = JSON.parse(event.data.toString()); | ||
incomingSignals.push(signal); | ||
signal = JSON.parse(event.data.toString()); | ||
} | ||
catch (e) { | ||
console.log("websocket decoding error:", e); | ||
return; | ||
} | ||
incomingSignals.push(signal); | ||
}; | ||
@@ -148,3 +150,5 @@ peer.connect(incomingSignals); | ||
Peer.prototype.signal = function (s) { | ||
this._peer.signal(s); | ||
if (!this._peer.isDestroyed()) { | ||
this._peer.signal(s); | ||
} | ||
}; | ||
@@ -151,0 +155,0 @@ Peer.prototype.log = function () { |
{ | ||
"name": "axiom-api", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"description": "API for interacting with the Axiom.org platform", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -30,2 +30,3 @@ // BasicPeer is a small wrapper around the SimplePeer provided by the | ||
isConnected(): boolean; | ||
isDestroyed(): boolean; | ||
} | ||
@@ -87,2 +88,6 @@ | ||
isDestroyed() { | ||
return this._peer.destroyed; | ||
} | ||
isConnected(): boolean { | ||
@@ -203,2 +208,6 @@ return this._peer.connected; | ||
isDestroyed() { | ||
return this.destroyed; | ||
} | ||
isConnected(): boolean { | ||
@@ -205,0 +214,0 @@ return this.connected; |
@@ -85,10 +85,12 @@ import WebSocket = require("isomorphic-ws"); | ||
ws.onmessage = event => { | ||
let signal; | ||
try { | ||
// According to TypeScript, at least, there are a bunch of stringlike data | ||
// types we could receive here. In practice I have only seen strings. | ||
let signal = JSON.parse(event.data.toString()); | ||
incomingSignals.push(signal); | ||
signal = JSON.parse(event.data.toString()); | ||
} catch (e) { | ||
console.log("websocket decoding error:", e); | ||
return; | ||
} | ||
incomingSignals.push(signal); | ||
}; | ||
@@ -180,3 +182,5 @@ peer.connect(incomingSignals); | ||
signal(s: object) { | ||
this._peer.signal(s); | ||
if (!this._peer.isDestroyed()) { | ||
this._peer.signal(s); | ||
} | ||
} | ||
@@ -183,0 +187,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
351399
6868