forked from Mirrors/doipjs
Make certain fetchers environment-aware
This commit is contained in:
parent
ffbae32a55
commit
e13bd4e9f5
3 changed files with 28 additions and 7 deletions
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const dns = require('dns')
|
||||
const jsEnv = require("browser-or-node")
|
||||
|
||||
/**
|
||||
* @module fetcher/dns
|
||||
|
@ -25,6 +25,13 @@ const dns = require('dns')
|
|||
*/
|
||||
module.exports.timeout = 5000
|
||||
|
||||
if (!jsEnv.isNode) {
|
||||
module.exports.fn = null
|
||||
return
|
||||
}
|
||||
|
||||
const dns = require('dns')
|
||||
|
||||
/**
|
||||
* Execute a fetch request
|
||||
* @function
|
||||
|
|
|
@ -13,8 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const irc = require('irc-upd')
|
||||
const validator = require('validator')
|
||||
const jsEnv = require("browser-or-node")
|
||||
|
||||
/**
|
||||
* @module fetcher/irc
|
||||
|
@ -26,6 +25,14 @@ const validator = require('validator')
|
|||
*/
|
||||
module.exports.timeout = 20000
|
||||
|
||||
if (!jsEnv.isNode) {
|
||||
module.exports.fn = null
|
||||
return
|
||||
}
|
||||
|
||||
const irc = require('irc-upd')
|
||||
const validator = require('validator')
|
||||
|
||||
/**
|
||||
* Execute a fetch request
|
||||
* @function
|
||||
|
|
|
@ -13,10 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const jsdom = require('jsdom')
|
||||
const { client, xml } = require('@xmpp/client')
|
||||
const debug = require('@xmpp/debug')
|
||||
const validator = require('validator')
|
||||
const jsEnv = require("browser-or-node")
|
||||
|
||||
/**
|
||||
* @module fetcher/xmpp
|
||||
|
@ -28,6 +25,16 @@ const validator = require('validator')
|
|||
*/
|
||||
module.exports.timeout = 5000
|
||||
|
||||
if (!jsEnv.isNode) {
|
||||
module.exports.fn = null
|
||||
return
|
||||
}
|
||||
|
||||
const jsdom = require('jsdom')
|
||||
const { client, xml } = require('@xmpp/client')
|
||||
const debug = require('@xmpp/debug')
|
||||
const validator = require('validator')
|
||||
|
||||
let xmpp = null,
|
||||
iqCaller = null
|
||||
|
||||
|
|
Loading…
Reference in a new issue