vue-cookie-next
Version:
A simple Vue.js plugin for handling browser cookies
65 lines (53 loc) • 1.39 kB
TypeScript
import { App } from 'vue';
declare interface _CookieBase {
expire?: expireTimes;
path?: string;
domain?: string;
secure?: string;
sameSite?: string;
}
declare interface CookieConfigOptions extends _CookieBase {
}
declare type expireTimes = string | number | Date;
declare interface IVueCookieNext {
/**
* Set global config
*/
config(options: CookieConfigOptions): void;
/**
* Set a cookie
*/
setCookie(keyName: keyName, value: string, options?: SetCookieOptions): this;
/**
* Get a cookie
*/
getCookie(keyName: keyName): any;
/**
* Remove a cookie
*/
removeCookie(keyName: keyName, options?: RemoveCookieOptions): this | boolean;
/**
* Exist a cookie name
*/
isCookieAvailable(keyName: keyName): boolean;
/**
* Get All cookie name
*/
keys(): string[];
install(app: App): void;
}
declare type keyName = string;
declare interface RemoveCookieOptions {
path?: string;
domain?: string;
}
declare interface SetCookieOptions extends _CookieBase {
}
export declare function useCookie(): IVueCookieNext;
export declare const VueCookieNext: IVueCookieNext;
export { }
declare module '@vue/runtime-core' {
export interface ComponentCustomProperties {
$cookie: IVueCookieNext
}
}