shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
setCookie
Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.cookie
Set a cookie
Params
- name*-String
The name of the cookie to set
- value*-Any
The cookie value to set
- settings{}Partial<ISetCookieSettings>
Some settings to configure your cookie
Example
import { setCookie } from '@blackbyte/sugar/cookie';
setCookie('myCookie', 'hello world');Settings
- path/String
The path of the cookie to store
- domain-String
The domain on which to store the cookie
- expires-String
The date when the cookie expires. If null, mean never expires
- max-age-Number
The number of seconds until the cookie expires
- secure-Boolean
Specify if the cookie is available only on HTTPS or not. true if page loaded on https, false if not
- samesite-Boolean|‘strict’|‘lax’
Controls whether or not a cookie is sent with cross-site requests, providing some protection against cross-site request forgery attacks (CSRF)
- httpOnly-Boolean
Forbids JavaScript from accessing the cookie, for example, through the Document.cookie property.
Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space