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 Sept. 22, 2023, 9:06 a.m.