Title: | 'JS-cookies' for 'Shiny' |
---|---|
Description: | Set and get browser cookies in 'Shiny' through 'JS-cookie'. |
Authors: | Colin Fay [cre, aut] , Klaus Hartl [ctb, cph] (Author of JS-Cookies) |
Maintainer: | Colin Fay <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2024-11-09 05:08:21 UTC |
Source: | https://github.com/tanho63/glouton |
Create a cookie object.
new()
Cookie$new(name, session = shiny::getDefaultReactiveDomain())
name
The name of the cookie.
session
A valid Shiny session.
Create a Cookie
get()
Cookie$get()
Get the value of the cookie
set()
Cookie$set(value, expires = 365L, path = "/")
value
Value of the cookie
expires
When the cookie is set to expire, integer indicating number of days.
path
Path where cookie is visible.
Set the value of the cookie
rm()
Cookie$rm()
Remove the cookie.
clone()
The objects of this class are cloneable with this method.
Cookie$clone(deep = FALSE)
deep
Whether to make a deep clone.
fetch_cookies
returns all the cookies, while fetch_cookie
search for
one cookie in the browser.
fetch_cookies(session = shiny::getDefaultReactiveDomain()) fetch_cookie(name, session = shiny::getDefaultReactiveDomain()) add_cookie( name, value, options = cookie_options(), debug = FALSE, session = shiny::getDefaultReactiveDomain() ) remove_cookie( name, options = cookie_options(), session = shiny::getDefaultReactiveDomain() ) cookie_options( expires = NULL, path = "/", domain = NULL, secure = FALSE, sameSite = "strict" )
fetch_cookies(session = shiny::getDefaultReactiveDomain()) fetch_cookie(name, session = shiny::getDefaultReactiveDomain()) add_cookie( name, value, options = cookie_options(), debug = FALSE, session = shiny::getDefaultReactiveDomain() ) remove_cookie( name, options = cookie_options(), session = shiny::getDefaultReactiveDomain() ) cookie_options( expires = NULL, path = "/", domain = NULL, secure = FALSE, sameSite = "strict" )
session |
The |
name |
Name of the cookie to set/fetch |
value |
The value to set for the cookie |
options |
A list of options returned from |
debug |
If |
expires |
Define when the cookie will be removed. Value must be a
numeric, which will be interpreted as days from time of creation or
a date. If |
path |
A string indicating the path where the cookie is visible. |
domain |
A string indicating a valid domain where the cookie should be visible. The cookie will also be visible to all subdomains. |
secure |
Boolean indicating whether the cookie transmission requires a secure protocol (https). |
sameSite |
A string allowing to control whether the browser is sending a cookie along with cross-site requests. |
Add glouton to your shiny app
use_glouton(online = TRUE)
use_glouton(online = TRUE)
online |
TRUE fetch the online version of js-cookie through CDN. FALSE uses the file included in the pckage. |