Files
auto-solution/modeler/types/js-cookie.d.ts

60 lines
1.3 KiB
TypeScript

/*
* This file is part of the kernelstudio package.
*
* (c) 2014-2025 zlin <admin@kernelstudio.com>
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*/
declare module 'js-cookie' {
interface CookiesStatic {
/**
* 获取指定名称的cookie值
* @param name cookie名称
* @returns cookie值或undefined
*/
get(name: string): string | undefined;
/**
* 获取所有cookie
* @returns 包含所有cookie键值对的对象
*/
get(): { [key: string]: string };
/**
* 设置cookie
* @param name cookie名称
* @param value cookie值
* @param options 配置项(过期时间、路径等)
* @returns 设置后的cookie字符串
*/
set(
name: string,
value: string,
options?: {
expires?: number | Date;
path?: string;
domain?: string;
secure?: boolean;
sameSite?: 'strict' | 'lax' | 'none';
}
): string;
/**
* 删除指定cookie
* @param name cookie名称
* @param options 配置项(需与设置时一致)
*/
remove(
name: string,
options?: {
path?: string;
domain?: string;
}
): void;
}
const Cookies: CookiesStatic;
export default Cookies;
}