EVOLUTION-MANAGER
Edit File: onStaticRenderComplete.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Execute JavaScript code after static render</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for onStaticRenderComplete {htmlwidgets}"><tr><td>onStaticRenderComplete {htmlwidgets}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Execute JavaScript code after static render</h2> <h3>Description</h3> <p>Convenience function for wrapping a JavaScript code string with a <code><script></code> tag and the boilerplate necessary to delay the execution of the code until after the next time htmlwidgets completes rendering any widgets that are in the page. This mechanism is designed for running code to customize widget instances, which can't be done at page load time since the widget instances will not have been created yet. </p> <h3>Usage</h3> <pre> onStaticRenderComplete(jsCode) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>jsCode</code></td> <td> <p>A character vector containing JavaScript code. No R error will be raised if the code is invalid, not even on JavaScript syntax errors. However, the web browser will throw errors at runtime.</p> </td></tr> </table> <h3>Details</h3> <p>Each call to <code>onStaticRenderComplete</code> will result in at most one invocation of the given code. In some edge cases in Shiny, it's possible for static rendering to happen more than once (e.g. a <code>renderUI</code> that contains static HTML widgets). <code>onStaticRenderComplete</code> calls only schedule execution for the next static render operation. </p> <p>The pure JavaScript equivalent of <code>onStaticRenderComplete</code> is <code>HTMLWidgets.addPostRenderHandler(callback)</code>, where <code>callback</code> is a JavaScript function that takes no arguments. </p> <h3>Value</h3> <p>An htmltools <code><a href="../../htmltools/html/tags.html">tags</a>$script</code> object. </p> <h3>Examples</h3> <pre> ## Not run: library(leaflet) library(htmltools) library(htmlwidgets) page <- tagList( leaflet() %>% addTiles(), onStaticRenderComplete( "HTMLWidgets.find('.leaflet').setZoom(4);" ) ) print(page, browse = TRUE) ## End(Not run) </pre> <hr /><div style="text-align: center;">[Package <em>htmlwidgets</em> version 1.5.1 <a href="00Index.html">Index</a>]</div> </body></html>