Skip to content

Commit

Permalink
Rename addRenderHook to onRender
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheng5 committed Dec 1, 2015
1 parent 6be861f commit e8ae75a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ S3method(as.tags,htmlwidget)
S3method(print,htmlwidget)
S3method(print,suppress_viewer)
export(JS)
export(addRenderHook)
export(appendContent)
export(createWidget)
export(onRender)
export(onStaticRenderComplete)
export(prependContent)
export(saveWidget)
Expand Down
4 changes: 2 additions & 2 deletions R/htmlwidgets.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ appendContent <- function(x, ...) {
#' library(leaflet)
#'
#' leaflet() %>% addTiles() %>%
#' addRenderHook("
#' onRender("
#' function(el, x) {
#' // Navigate the map to the user's location
#' this.locate({setView: true});
Expand All @@ -103,7 +103,7 @@ appendContent <- function(x, ...) {
#' }
#'
#' @export
addRenderHook <- function(x, jsCode) {
onRender <- function(x, jsCode) {
addHook(x, "render", jsCode)
}

Expand Down
8 changes: 4 additions & 4 deletions man/addRenderHook.Rd → man/onRender.Rd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/htmlwidgets.R
\name{addRenderHook}
\alias{addRenderHook}
\name{onRender}
\alias{onRender}
\title{Execute custom JavaScript code after rendering}
\usage{
addRenderHook(x, jsCode)
onRender(x, jsCode)
}
\arguments{
\item{x}{An HTML Widget object}
Expand Down Expand Up @@ -33,7 +33,7 @@ The \code{jsCode} parameter must be a valid JavaScript expression
library(leaflet)

leaflet() \%>\% addTiles() \%>\%
addRenderHook("
onRender("
function(el, x) {
// Navigate the map to the user's location
this.locate({setView: true});
Expand Down

0 comments on commit e8ae75a

Please sign in to comment.