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")

Try the pkgload package in your browser

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

pkgload documentation built on June 28, 2024, 5:07 p.m.