租房小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
477 B

3 months ago
  1. import platform from 'platform';
  2. import pkg from '../../browser/version';
  3. import { checkUserAgent } from './checkUserAgent';
  4. export const getUserAgent = () => {
  5. const agent = process && process.browser ? 'js' : 'nodejs';
  6. const sdk = `aliyun-sdk-${agent}/${pkg.version}`;
  7. let plat = platform.description;
  8. if (!plat && process) {
  9. plat = `Node.js ${process.version.slice(1)} on ${process.platform} ${process.arch}`;
  10. }
  11. return checkUserAgent(`${sdk} ${plat}`);
  12. };