Sha256: c2f64357545e08a64a963e5acc07f3e12a35b171f11e1d253d2f6e21c4158811
Contents?: true
Size: 1.32 KB
Versions: 34
Compression:
Stored size: 1.32 KB
Contents
'use strict'; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:utils:transport'); } module.exports = function(availableTransports) { return { filterToEnabled: function(transportsWhitelist, info) { var transports = { main: [] , facade: [] }; if (!transportsWhitelist) { transportsWhitelist = []; } else if (typeof transportsWhitelist === 'string') { transportsWhitelist = [transportsWhitelist]; } availableTransports.forEach(function(trans) { if (!trans) { return; } if (trans.transportName === 'websocket' && info.websocket === false) { debug('disabled from server', 'websocket'); return; } if (transportsWhitelist.length && transportsWhitelist.indexOf(trans.transportName) === -1) { debug('not in whitelist', trans.transportName); return; } if (trans.enabled(info)) { debug('enabled', trans.transportName); transports.main.push(trans); if (trans.facadeTransport) { transports.facade.push(trans.facadeTransport); } } else { debug('disabled', trans.transportName); } }); return transports; } }; };
Version data entries
34 entries across 33 versions & 12 rubygems