Package 'shinyEventsCookies'

Title: Cookie support for shinyEvents apps
Description: Cookie support for shinyEvents apps
Authors: Sebastian Kranz
Maintainer: Sebastian Kranz <[email protected]>
License: GPL >= 2.0
Version: 0.1.0
Built: 2026-05-07 07:29:18 UTC
Source: https://github.com/skranz/shinyEventsCookies

Help Index


Check if application cookies have been loaded

Description

Determines whether cookies have been loaded into the current app session.

Usage

areAppCookiesLoaded(app = getApp())

Arguments

app

The shiny app object (default: getApp())

Value

Logical value indicating if cookies were loaded


Create cookies header for Shiny UI

Description

Generates HTML header elements with JavaScript to handle cookies in a Shiny app.

Usage

cookiesHeader(onload.cookies = NULL, eventId = "loadPageCookies", ...)

Arguments

onload.cookies

Vector of cookie names to load on initialization (default: NULL for all cookies)

eventId

Character string specifying the event identifier (default: "loadPageCookies")

...

Additional arguments passed to underlying functions

Value

A tagList of HTML dependencies and JavaScript for cookie handling


Get loaded cookies from app object

Description

Retrieves previously loaded cookies from the app's internal state.

Usage

getLoadedCookies(app = getApp())

Arguments

app

The shiny app object (default: getApp())

Value

The loaded cookies or NULL if none exist


Create a handler for loading page cookies

Description

Sets up an event handler to load cookies from the client browser.

Usage

loadPageCookiesHandler(
  fun,
  eventId = "loadPageCookies",
  no.authentication.required = TRUE
)

Arguments

fun

Function to be called when cookies are loaded

eventId

Character string specifying the event identifier (default: "loadPageCookies")

no.authentication.required

Logical indicating whether authentication is required (default: TRUE)

Value

Returns the result of the eventHandler call


Remove a cookie from the client browser

Description

Deletes the specified cookie from the user's browser.

Usage

removeCookie(id)

Arguments

id

The name/identifier of the cookie to remove

Value

No return value, called for side effect


Set a javascript cookie on the client computer

Description

Set a javascript cookie on the client computer

Usage

setCookie(id, values, expires = NULL, opts = list())

Arguments

id

the name of the cookie

values

a named list of values, will be transformed to JSON

expires

if null the cookie is valid until the browser closes. If not null number of days until the cookie expires. The cookie will then persistently stored, if client computer allows

opts

a named list of additional options as explained on https://github.com/js-cookie/js-cookie


Set loaded cookies in app object

Description

Stores loaded cookies in the app's internal state.

Usage

setLoadedCookies(cookies, app = getApp())

Arguments

cookies

The cookies to store

app

The shiny app object (default: getApp())

Value

No return value, called for side effect