browser-id
Version:
Unique ID for current browser (client).
28 lines (27 loc) • 985 B
TypeScript
/**
* Returns a consistent unique identifier for this browser (or the Node/Deno environment).
*
* If no identifier exists yet, one is generated and persisted.
* @returns {string} The existing or newly generated browser identifier.
*/
export declare function getBrowserId(): string;
/**
* Backwards-compatible alias for getBrowserId().
* @returns {string} The existing or newly generated browser identifier.
*/
export declare function browserId(): string;
/**
* Check whether a browser ID is already persisted without generating one.
* @returns {boolean} True if a browser ID is currently persisted.
*/
export declare function hasBrowserId(): boolean;
/**
* Delete any persisted browser ID from the underlying storage.
* @returns {void}
*/
export declare function deleteBrowserId(): void;
/**
* Force-generate a new browser ID, persist it, and return it.
* @returns {string} The newly generated browser identifier.
*/
export declare function rotateBrowserId(): string;