1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 1 1 1 | /** * @file 环境探测 * @author Leon(leon@outlook.com) * @module env * @inner */ try { /** * 是否为服务器端环境 * * @member {boolean} */ exports.isServer = 'object' === typeof process && Object.prototype.toString.call(process) === '[object process]'; } catch(e) {} /** * 是否为客户端环境 * * @member {boolean} */ exports.isClient = !exports.isServer; |