CookiePart Class

Extends KeyValueSourcePart and allows interaction with a particular key in the browser’s cookie storage. It provides methods for retrieving, setting, and observing the cookie value associated with the given key

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

See also: CookieData, CookieParams

API

class CookiePart<T extends CookieData<any> = CookieData<string | undefined>>
extends KeyValueSourcePart<T> {
  readonly $: Observable<T>;
  constructor(key: string, removeParams?: CookieParams);
  get(): T;
  set(value: T): void;
  remove(): void;
}

Example

import {CookiePart} from '@bitfiber/rx';
 
const ckPart = new CookiePart('key');