Skip to content

Commit cb8c324

Browse files
committed
Support lazy 'wrtc' module initialization
For: webtorrent/webtorrent-hybrid#46
1 parent f21911a commit cb8c324

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

client.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,12 @@ function Client (opts) {
6161
self.destroyed = false
6262

6363
self._rtcConfig = opts.rtcConfig
64-
self._wrtc = opts.wrtc
6564
self._getAnnounceOpts = opts.getAnnounceOpts
65+
self._wrtc = opts.wrtc
66+
67+
// Support lazy 'wrtc' module initialization
68+
// See: https://github.com/feross/webtorrent-hybrid/issues/46
69+
if (typeof self._wrtc === 'function') self._wrtc = self._wrtc()
6670

6771
debug('new client %s', self.infoHash)
6872

0 commit comments

Comments
 (0)