-
Notifications
You must be signed in to change notification settings - Fork 1
/
getBinding.r
112 lines (106 loc) · 2.39 KB
/
getBinding.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#' @title
#' Get Binding Function (generic)
#'
#' @description
#' Retrieves the binding function by which a reactive object is bound to
#' other referenced reactive objects.
#'
#' @details
#' This is a convenience function to retrieve the value of field \code{.func}
#' from the invisible objects stored in the registry.
#'
#' @param id \strong{Signature argument}.
#' Object containing name/ID information.
#' @param where \strong{Signature argument}.
#' Object containing location information.
#' @template threedots
#' @example inst/examples/getBinding.r
#' @seealso \code{
#' \link[reactr]{getBinding-character-environment-method}
#' }
#' @template author
#' @template references
setGeneric(
name = "getBinding",
signature = c(
"id",
"where"
),
def = function(
id,
where = parent.frame(),
...
) {
standardGeneric("getBinding")
}
)
#' @title
#' Get Binding Function (character-missing)
#'
#' @description
#' See generic: \code{\link[reactr]{getBinding}}
#'
#' @inheritParams getBinding
#' @param id \code{\link{character}}.
#' @param where \code{\link{missing}}.
#' @return See method
#' \code{\link[reactr]{getBinding-character-environment-method}}
#' @example inst/examples/getBinding.r
#' @seealso \code{
#' \link[reactr]{getBinding},
#' \link[reactr]{getBinding-character-environment-method}
#' }
#' @template author
#' @template references
#' @export
#' @aliases getBinding-character-missing-method
setMethod(
f = "getBinding",
signature = signature(
id = "character",
where = "missing"
),
definition = function(
id,
where,
...
) {
getBinding(
id = id,
where = where,
...
)
}
)
#' @title
#' Get Binding Function (character-environment)
#'
#' @description
#' See generic: \code{\link[reactr]{getBinding}}
#'
#' @inheritParams getBinding
#' @param id \code{\link{character}}.
#' @param where \code{\link{environment}}.
#' @return \code{\link{function}}. Binding function.
#' @example inst/examples/getBinding.r
#' @seealso \code{
#' \link[reactr]{getBinding}
#' }
#' @template author
#' @template references
#' @aliases getBinding-character-environment-method
#' @export
setMethod(
f = "getBinding",
signature = signature(
id = "character",
where = "environment"
),
definition = function(
id,
where,
...
) {
getFromRegistry(id = id, where = where)$.func
}
)