R/Listener.R

Defines functions listener

Documented in listener

#' Define a Listener
#'
#' @description
#' Define a listener. This is a user-friendly wrapper for
#' the class constructor \code{Listener$new()}. Users who are not familiar with
#' the concept of classes may consider using this wrapper directly.
#'
#' Listener is an important concept of \code{TrialSimulator}. Used with a
#' trial object in a controller, a listener can monitor a running trial to
#' execute user-defined actions when it determine condition of triggering a
#' milestone is met. This mechanism allows the package users to focus on
#' the development of action functions in a simulation.
#'
#' @param silent logical. \code{TRUE} to mute messages.
#'
#' @examples
#'
#' listener <- listener()
#'
#' @return an object of R6 class \code{Listeners}, monitoring and triggering milestones of a trial.
#'
#' @export
#'
listener <- function(silent = FALSE){
  Listeners$new(silent = silent)
}

Try the TrialSimulator package in your browser

Any scripts or data that you put into this service are public.

TrialSimulator documentation built on Sept. 4, 2026, 5:08 p.m.