mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-18 20:21:36 +00:00
Use queueMicrotask on client
This commit is contained in:
parent
0c4911eaea
commit
d8bb9c53f7
@ -3,6 +3,7 @@ const EventEmitter = require('events')
|
|||||||
const once = require('once')
|
const once = require('once')
|
||||||
const parallel = require('run-parallel')
|
const parallel = require('run-parallel')
|
||||||
const Peer = require('simple-peer')
|
const Peer = require('simple-peer')
|
||||||
|
const queueMicrotask = require('queue-microtask')
|
||||||
|
|
||||||
const common = require('./lib/common')
|
const common = require('./lib/common')
|
||||||
const HTTPTracker = require('./lib/client/http-tracker') // empty object in browser
|
const HTTPTracker = require('./lib/client/http-tracker') // empty object in browser
|
||||||
@ -76,7 +77,7 @@ class Client extends EventEmitter {
|
|||||||
const webrtcSupport = this._wrtc !== false && (!!this._wrtc || Peer.WEBRTC_SUPPORT)
|
const webrtcSupport = this._wrtc !== false && (!!this._wrtc || Peer.WEBRTC_SUPPORT)
|
||||||
|
|
||||||
const nextTickWarn = err => {
|
const nextTickWarn = err => {
|
||||||
process.nextTick(() => {
|
queueMicrotask(() => {
|
||||||
this.emit('warning', err)
|
this.emit('warning', err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
"lru": "^3.1.0",
|
"lru": "^3.1.0",
|
||||||
"minimist": "^1.2.5",
|
"minimist": "^1.2.5",
|
||||||
"once": "^1.4.0",
|
"once": "^1.4.0",
|
||||||
|
"queue-microtask": "^1.2.2",
|
||||||
"random-iterate": "^1.0.1",
|
"random-iterate": "^1.0.1",
|
||||||
"randombytes": "^2.1.0",
|
"randombytes": "^2.1.0",
|
||||||
"run-parallel": "^1.1.9",
|
"run-parallel": "^1.1.9",
|
||||||
|
Loading…
Reference in New Issue
Block a user