Cookie Class

Provides access to browser cookies as a key-value storage.
The Cookie class implements the KeyValueSource interface, allowing interaction with browser cookies using key-value semantics. It provides methods for retrieving, setting, observing, and removing cookies

@template T = any
Represents an object that includes both the value and parameters for the cookie.
Defaults to CookieData<string | undefined>

See also: CookieData, CookieParams

API

class Cookie<T extends CookieData<any> = CookieData<string | undefined>>
implements KeyValueSource<T> {
  get(key: string): T;
  set(key: string, value: T): void;
  remove(key: string, params?: CookieParams): void;
  observe(key: string): Observable<T>;
  destroy(): void;
}

Example

import {Cookie} from '@bitfiber/rx';
 
const ck = new Cookie();