peer-data
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -29,2 +29,3 @@ // Generated by dts-bundle v0.7.3 | ||
static CONNECTION: string; | ||
static SEND: string; | ||
} | ||
@@ -31,0 +32,0 @@ |
@@ -33,3 +33,3 @@ import { EventDispatcher } from './EventDispatcher'; | ||
App.prototype.connect = function (roomId) { | ||
EventDispatcher.dispatch('send', { | ||
EventDispatcher.dispatch(AppEventType.SEND, { | ||
type: SignalingEventType.CONNECT, | ||
@@ -43,3 +43,3 @@ caller: null, | ||
App.prototype.disconnect = function (roomId) { | ||
EventDispatcher.dispatch('send', { | ||
EventDispatcher.dispatch(AppEventType.SEND, { | ||
type: SignalingEventType.DISCONNECT, | ||
@@ -101,3 +101,3 @@ caller: null, | ||
.then(function (desc) { return peer.setLocalDescription(desc); }) | ||
.then(function () { return EventDispatcher.dispatch('send', { | ||
.then(function () { return EventDispatcher.dispatch(AppEventType.SEND, { | ||
type: SignalingEventType.ANSWER, | ||
@@ -123,3 +123,3 @@ caller: null, | ||
if (null !== peer && null !== channel) { | ||
EventDispatcher.dispatch('send', { | ||
EventDispatcher.dispatch(AppEventType.SEND, { | ||
type: SignalingEventType.ROOM, | ||
@@ -163,3 +163,3 @@ caller: null, | ||
.then(function (desc) { return peer.setLocalDescription(desc); }) | ||
.then(function () { return EventDispatcher.dispatch('send', { | ||
.then(function () { return EventDispatcher.dispatch(AppEventType.SEND, { | ||
type: SignalingEventType.OFFER, | ||
@@ -166,0 +166,0 @@ caller: null, |
export declare class AppEventType { | ||
static LOG: string; | ||
static CONNECTION: string; | ||
static SEND: string; | ||
} |
@@ -9,2 +9,3 @@ var AppEventType = (function () { | ||
AppEventType.CONNECTION = 'CONNECTION'; | ||
AppEventType.SEND = 'SEND'; | ||
//# sourceMappingURL=AppEventType.js.map |
@@ -12,9 +12,13 @@ export var HANDLERS = {}; | ||
EventDispatcher.unregister = function (type, callback) { | ||
var index = HANDLERS[type].indexOf(callback); | ||
if (index !== -1) { | ||
delete HANDLERS[type][index]; | ||
if (HANDLERS[type]) { | ||
var index = HANDLERS[type].indexOf(callback); | ||
if (index !== -1) { | ||
delete HANDLERS[type][index]; | ||
} | ||
} | ||
}; | ||
EventDispatcher.dispatch = function (type, data) { | ||
HANDLERS[type].forEach(function (h) { return h(data); }); | ||
if (HANDLERS[type]) { | ||
HANDLERS[type].forEach(function (h) { return h(data); }); | ||
} | ||
}; | ||
@@ -21,0 +25,0 @@ return EventDispatcher; |
import { EventDispatcher } from './EventDispatcher'; | ||
import { SignalingEventType } from './SignalingEventType'; | ||
import { AppEventType } from './AppEventType'; | ||
var PeerFactory = (function () { | ||
@@ -17,3 +18,3 @@ function PeerFactory() { | ||
}; | ||
EventDispatcher.dispatch('send', message); | ||
EventDispatcher.dispatch(AppEventType.SEND, message); | ||
} | ||
@@ -20,0 +21,0 @@ else { |
@@ -7,3 +7,3 @@ import { EventDispatcher } from './EventDispatcher'; | ||
this.socket = io.connect(opts); | ||
EventDispatcher.register('send', this.onSend.bind(this)); | ||
EventDispatcher.register(AppEventType.SEND, this.onSend.bind(this)); | ||
this.subscribeEvents(); | ||
@@ -10,0 +10,0 @@ } |
@@ -35,3 +35,3 @@ "use strict"; | ||
App.prototype.connect = function (roomId) { | ||
EventDispatcher_1.EventDispatcher.dispatch('send', { | ||
EventDispatcher_1.EventDispatcher.dispatch(AppEventType_1.AppEventType.SEND, { | ||
type: SignalingEventType_1.SignalingEventType.CONNECT, | ||
@@ -45,3 +45,3 @@ caller: null, | ||
App.prototype.disconnect = function (roomId) { | ||
EventDispatcher_1.EventDispatcher.dispatch('send', { | ||
EventDispatcher_1.EventDispatcher.dispatch(AppEventType_1.AppEventType.SEND, { | ||
type: SignalingEventType_1.SignalingEventType.DISCONNECT, | ||
@@ -103,3 +103,3 @@ caller: null, | ||
.then(function (desc) { return peer.setLocalDescription(desc); }) | ||
.then(function () { return EventDispatcher_1.EventDispatcher.dispatch('send', { | ||
.then(function () { return EventDispatcher_1.EventDispatcher.dispatch(AppEventType_1.AppEventType.SEND, { | ||
type: SignalingEventType_1.SignalingEventType.ANSWER, | ||
@@ -125,3 +125,3 @@ caller: null, | ||
if (null !== peer && null !== channel) { | ||
EventDispatcher_1.EventDispatcher.dispatch('send', { | ||
EventDispatcher_1.EventDispatcher.dispatch(AppEventType_1.AppEventType.SEND, { | ||
type: SignalingEventType_1.SignalingEventType.ROOM, | ||
@@ -165,3 +165,3 @@ caller: null, | ||
.then(function (desc) { return peer.setLocalDescription(desc); }) | ||
.then(function () { return EventDispatcher_1.EventDispatcher.dispatch('send', { | ||
.then(function () { return EventDispatcher_1.EventDispatcher.dispatch(AppEventType_1.AppEventType.SEND, { | ||
type: SignalingEventType_1.SignalingEventType.OFFER, | ||
@@ -168,0 +168,0 @@ caller: null, |
export declare class AppEventType { | ||
static LOG: string; | ||
static CONNECTION: string; | ||
static SEND: string; | ||
} |
@@ -10,3 +10,4 @@ "use strict"; | ||
AppEventType.CONNECTION = 'CONNECTION'; | ||
AppEventType.SEND = 'SEND'; | ||
exports.AppEventType = AppEventType; | ||
//# sourceMappingURL=AppEventType.js.map |
@@ -14,9 +14,13 @@ "use strict"; | ||
EventDispatcher.unregister = function (type, callback) { | ||
var index = exports.HANDLERS[type].indexOf(callback); | ||
if (index !== -1) { | ||
delete exports.HANDLERS[type][index]; | ||
if (exports.HANDLERS[type]) { | ||
var index = exports.HANDLERS[type].indexOf(callback); | ||
if (index !== -1) { | ||
delete exports.HANDLERS[type][index]; | ||
} | ||
} | ||
}; | ||
EventDispatcher.dispatch = function (type, data) { | ||
exports.HANDLERS[type].forEach(function (h) { return h(data); }); | ||
if (exports.HANDLERS[type]) { | ||
exports.HANDLERS[type].forEach(function (h) { return h(data); }); | ||
} | ||
}; | ||
@@ -23,0 +27,0 @@ return EventDispatcher; |
@@ -5,2 +5,3 @@ "use strict"; | ||
var SignalingEventType_1 = require("./SignalingEventType"); | ||
var AppEventType_1 = require("./AppEventType"); | ||
var PeerFactory = (function () { | ||
@@ -20,3 +21,3 @@ function PeerFactory() { | ||
}; | ||
EventDispatcher_1.EventDispatcher.dispatch('send', message); | ||
EventDispatcher_1.EventDispatcher.dispatch(AppEventType_1.AppEventType.SEND, message); | ||
} | ||
@@ -23,0 +24,0 @@ else { |
@@ -9,3 +9,3 @@ "use strict"; | ||
this.socket = io.connect(opts); | ||
EventDispatcher_1.EventDispatcher.register('send', this.onSend.bind(this)); | ||
EventDispatcher_1.EventDispatcher.register(AppEventType_1.AppEventType.SEND, this.onSend.bind(this)); | ||
this.subscribeEvents(); | ||
@@ -12,0 +12,0 @@ } |
{ | ||
"name": "peer-data", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "PeerData - library for files, media streaming/sharing using WebRTC", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
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
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
433887
1464
0