handler_ntfy: Progression Handler: Progress Reported via the Ntfy.sh...

View source: R/handler_ntfy.R

handler_ntfyR Documentation

Progression Handler: Progress Reported via the Ntfy.sh Messaging Service

Description

A progression handler for ntfy_send() of the ntfy package, which sends notifications via the https://ntfy.sh framework.

Usage

handler_ntfy(
  intrusiveness = getOption("progressr.intrusiveness.ntfy", 5),
  target = "gui",
  ...,
  title = "Progress update from R"
)

Arguments

intrusiveness

(numeric) A non-negative scalar on how intrusive (disruptive) the reporter to the user.

target

(character vector) Specifies where progression updates are rendered.

title

title of notification. See https://docs.ntfy.sh/publish/#message-title

...

Additional arguments passed to make_progression_handler().

Requirements

This progression handler requires the ntfy package, which is only available from https://github.com/jonocarroll/ntfy.

Examples

pkg <- "ntfy"
if (requireNamespace(pkg, quietly = TRUE)) {
  ## We need to specify a ntfy.sh topic that progress messages
  ## should be sent to. See help("ntfy_topic", package = "ntfy")
  ## for details
  Sys.setenv("NTFY_TOPIC", "R-my-secret-topic")

  handlers("ntfy")
  with_progress({ y <- slow_sum(1:10) })
  print(y)
}

progressr documentation built on Oct. 29, 2024, 9:06 a.m.