Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
some of the requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfakhri committed Jan 15, 2017
1 parent 33b18f3 commit d4ea43e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/webrtc-star/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ function WebRTCStar () {
options = {}
}

if (!callback) {
callback = function noop () {}
}
callback = callback || function () {}

const intentId = (~~(Math.random() * 1e9)).toString(36) + Date.now()
const sioClient = listeners[Object.keys(listeners)[0]].io
Expand Down Expand Up @@ -112,9 +110,7 @@ function WebRTCStar () {
const listener = new EE()

listener.listen = (ma, callback) => {
if (!callback) {
callback = function noop () {}
}
callback = callback || function () {}

const sioUrl = 'http://' + ma.toString().split('/')[3] + ':' + ma.toString().split('/')[5]

Expand All @@ -138,9 +134,8 @@ function WebRTCStar () {
callback()
})
listener.close = (callback) => {
if (!callback) {
callback = function noop () {}
}
callback = callback || function () {}

listener.io.emit('ss-leave', ma.toString())
setTimeout(() => {
listener.io.disconnect()
Expand All @@ -150,7 +145,7 @@ function WebRTCStar () {
}, 100)
}
listener.getAddrs = (callback) => {
process.nextTick(() => {
setImmediate(() => {
callback(null, [ma])
})
}
Expand Down

0 comments on commit d4ea43e

Please sign in to comment.