oro:cookies
oro:cookies reads and writes cookies for application-controlled origins.
Examples#
Set, read, and remove cookies for an application-controlled origin:
import { set, get, remove } from 'oro:cookies'
await set('https://app.example', 'session=abc123; Path=/; HttpOnly')
console.log(await get('https://app.example'))
await remove('https://app.example', 'session')
API reference#
Module specifiers#
oro:cookies
TypeScript declarations#
These declarations are generated from the runtime's published TypeScript surface.
oro:cookies#
declare module "oro:cookies" {
/**
* Get cookies for a URL as a `Cookie` header value ("a=b; c=d").
*
* @param {string} url
* @returns {Promise<{ value: string }>}
*/
export function get(url: string): Promise<{
value: string;
}>;
/**
* Set a cookie for a URL from a `Set-Cookie` header value.
*
* @param {string} url
* @param {string} cookie - a Set-Cookie header value
* @returns {Promise<{ ok: boolean }>}
*/
export function set(url: string, cookie: string): Promise<{
ok: boolean;
}>;
/**
* Remove cookies matching `name` for a URL.
*
* @param {string} url
* @param {string} name
* @returns {Promise<{ ok: boolean }>}
*/
export function remove(url: string, name: string): Promise<{
ok: boolean;
}>;
/**
* Clear all cookies in the current WebView data store.
*
* @returns {Promise<{ ok: boolean }>}
*/
export function clear(): Promise<{
ok: boolean;
}>;
namespace _default {
export { get };
export { set };
export { remove };
export { clear };
}
export default _default;
}
See also#
Source repository · Edit this page · View Markdown