tests/testthat/testHooks/R/a.r

record_use <- function(hook) {
  function(...) {
    h <- globalenv()$hooks
    h$events <- c(h$events, hook)
  }
}

.onLoad <-   record_use("pkg_load")
.onUnload <- record_use("pkg_unload")
.onAttach <- record_use("pkg_attach")
.onDetach <- record_use("pkg_detach")
r-pkgs/pkgload documentation built on Feb. 5, 2024, 5:43 a.m.