From cb8c324ebe3e72f6ff82e332327881a19b7edc28 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Mon, 3 Oct 2016 23:42:02 -0700 Subject: [PATCH] Support lazy 'wrtc' module initialization For: https://github.com/feross/webtorrent-hybrid/issues/46 --- client.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client.js b/client.js index 5f35ce2..7265f54 100644 --- a/client.js +++ b/client.js @@ -61,8 +61,12 @@ function Client (opts) { self.destroyed = false self._rtcConfig = opts.rtcConfig - self._wrtc = opts.wrtc self._getAnnounceOpts = opts.getAnnounceOpts + self._wrtc = opts.wrtc + + // Support lazy 'wrtc' module initialization + // See: https://github.com/feross/webtorrent-hybrid/issues/46 + if (typeof self._wrtc === 'function') self._wrtc = self._wrtc() debug('new client %s', self.infoHash)