msRestUserAgentPolicy.browser.ts 758 B

123456789101112131415161718192021222324252627
  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License. See License.txt in the project root for license information.
  3. /*
  4. * NOTE: When moving this file, please update "browser" section in package.json
  5. * and "plugins" section in webpack.testconfig.ts.
  6. */
  7. import { TelemetryInfo } from "./userAgentPolicy";
  8. interface NavigatorEx extends Navigator {
  9. readonly oscpu: string | undefined;
  10. }
  11. export function getDefaultUserAgentKey(): string {
  12. return "x-ms-command-name";
  13. }
  14. export function getPlatformSpecificData(): TelemetryInfo[] {
  15. const navigator = window.navigator as NavigatorEx;
  16. const osInfo = {
  17. key: "OS",
  18. value: (navigator.oscpu || navigator.platform).replace(" ", "")
  19. };
  20. return [osInfo];
  21. }