| Line 1... |
Line 1... |
| 1 |
% File src/library/base/man/ns-hooks.Rd
|
1 |
% File src/library/base/man/ns-hooks.Rd
|
| 2 |
% Part of the R package, https://www.R-project.org
|
2 |
% Part of the R package, https://www.R-project.org
|
| 3 |
% Copyright 1995-2015 R Core Team
|
3 |
% Copyright 1995-2017 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{ns-hooks}
|
6 |
\name{ns-hooks}
|
| 7 |
\alias{.onLoad}
|
7 |
\alias{.onLoad}
|
| 8 |
\alias{.onUnload}
|
8 |
\alias{.onUnload}
|
| Line 36... |
Line 36... |
| 36 |
When the package is attached (via \code{\link{library}} or
|
36 |
When the package is attached (via \code{\link{library}} or
|
| 37 |
\code{\link{attachNamespace}}), the hook function \code{.onAttach} is
|
37 |
\code{\link{attachNamespace}}), the hook function \code{.onAttach} is
|
| 38 |
looked for and if found is called (with two unnamed arguments) before
|
38 |
looked for and if found is called (with two unnamed arguments) before
|
| 39 |
the package environment is sealed.
|
39 |
the package environment is sealed.
|
| 40 |
|
40 |
|
| 41 |
If a function \code{.onDetach} (as from \R 3.0.0) is in the namespace
|
41 |
If a function \code{.onDetach} is in the namespace or \code{.Last.lib}
|
| 42 |
or \code{.Last.lib} is exported from the package, it will be called
|
42 |
is exported from the package, it will be called (with a single
|
| 43 |
(with a single argument) when the package is \code{\link{detach}}ed.
|
43 |
argument) when the package is \code{\link{detach}}ed. Beware that it
|
| 44 |
Beware that it might be called if \code{.onAttach} has failed, so it should be
|
44 |
might be called if \code{.onAttach} has failed, so it should be
|
| 45 |
written defensively. (It is called within \code{\link{tryCatch}}, so
|
45 |
written defensively. (It is called within \code{\link{tryCatch}}, so
|
| 46 |
errors will not stop the package being detached.)
|
46 |
errors will not stop the package being detached.)
|
| 47 |
|
47 |
|
| 48 |
If a namespace is unloaded (via \code{\link{unloadNamespace}}), a hook
|
48 |
If a namespace is unloaded (via \code{\link{unloadNamespace}}), a hook
|
| 49 |
function \code{.onUnload} is run (with a single argument) before final
|
49 |
function \code{.onUnload} is run (with a single argument) before final
|