Skip to content

Commit

Permalink
feat: Add browser info. (#576)
Browse files Browse the repository at this point in the history
  • Loading branch information
kinyoklion authored Sep 10, 2024
1 parent e763e5d commit a2f4398
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
18 changes: 18 additions & 0 deletions packages/sdk/browser/src/platform/BrowserInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Info, PlatformData, SdkData } from '@launchdarkly/js-client-sdk-common';

import { name, version } from '../../package.json';

export default class BrowserInfo implements Info {
platformData(): PlatformData {
return {
name: 'JS', // Name maintained from previous 3.x implementation.
};
}
sdkData(): SdkData {
return {
name,
version,
userAgentBase: 'JSClient',
};
}
}
13 changes: 5 additions & 8 deletions packages/sdk/browser/src/platform/BrowserPlatform.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import {
Crypto,
/* platform */
LDOptions,
Storage,
} from '@launchdarkly/js-client-sdk-common';
import { Crypto, Encoding, Info, LDOptions, Storage } from '@launchdarkly/js-client-sdk-common';

import BrowserCrypto from './BrowserCrypto';
import BrowserEncoding from './BrowserEncoding';
import BrowserInfo from './BrowserInfo';
import LocalStorage, { isLocalStorageSupported } from './LocalStorage';

export default class BrowserPlatform /* implements platform.Platform */ {
// encoding?: Encoding;
// info: Info;
encoding?: Encoding = new BrowserEncoding();
info: Info = new BrowserInfo();
// fileSystem?: Filesystem;
crypto: Crypto = new BrowserCrypto();
// requests: Requests;
Expand Down

0 comments on commit a2f4398

Please sign in to comment.