Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sweng-group-15
liowebrtc
Commits
afa8666f
Commit
afa8666f
authored
Oct 13, 2019
by
Moritz Langenstein
Browse files
(ml5717) Pass along peer on channel close and error events
parent
14adace8
Changes
2
Hide whitespace changes
Inline
Side-by-side
dist/peer.js
View file @
afa8666f
...
...
@@ -213,8 +213,8 @@ var Peer = function (_WildEmitter) {
key
:
'
_observeDataChannel
'
,
value
:
function
_observeDataChannel
(
channel
,
peer
)
{
var
self
=
this
;
channel
.
onclose
=
this
.
emit
.
bind
(
this
,
'
channelClose
'
,
channel
);
channel
.
onerror
=
this
.
emit
.
bind
(
this
,
'
channelError
'
,
channel
);
channel
.
onclose
=
this
.
emit
.
bind
(
this
,
'
channelClose
'
,
channel
,
peer
);
channel
.
onerror
=
this
.
emit
.
bind
(
this
,
'
channelError
'
,
channel
,
peer
);
channel
.
onmessage
=
function
(
event
)
{
self
.
emit
(
'
channelMessage
'
,
self
,
channel
.
label
,
JSON
.
parse
(
event
.
data
),
channel
,
event
);
};
...
...
src/peer.js
View file @
afa8666f
...
...
@@ -164,8 +164,8 @@ class Peer extends WildEmitter {
// Internal method registering handlers for a data channel and emitting events on the peer
_observeDataChannel
(
channel
,
peer
)
{
const
self
=
this
;
channel
.
onclose
=
this
.
emit
.
bind
(
this
,
'
channelClose
'
,
channel
);
channel
.
onerror
=
this
.
emit
.
bind
(
this
,
'
channelError
'
,
channel
);
channel
.
onclose
=
this
.
emit
.
bind
(
this
,
'
channelClose
'
,
channel
,
peer
);
channel
.
onerror
=
this
.
emit
.
bind
(
this
,
'
channelError
'
,
channel
,
peer
);
channel
.
onmessage
=
(
event
)
=>
{
self
.
emit
(
'
channelMessage
'
,
self
,
channel
.
label
,
JSON
.
parse
(
event
.
data
),
channel
,
event
);
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment