Module: React::ServerRendering
- Defined in:
- lib/react/server_rendering.rb,
lib/react/server_rendering/bundle_renderer.rb,
lib/react/server_rendering/exec_js_renderer.rb,
lib/react/server_rendering/manifest_container.rb,
lib/react/server_rendering/environment_container.rb,
lib/react/server_rendering/yaml_manifest_container.rb,
lib/react/server_rendering/webpacker_manifest_container.rb
Defined Under Namespace
Classes: BundleRenderer, EnvironmentContainer, ExecJSRenderer, ManifestContainer, PrerenderError, WebpackerManifestContainer, YamlManifestContainer
Class Method Summary collapse
-
.render(component_name, props, prerender_options) ⇒ String
Check a renderer out of the pool and use it to render the component.
-
.reset_pool ⇒ void
Discard the old ConnectionPool & create a new one.
-
.with_renderer ⇒ Object
Yield a renderer for an arbitrary block.
Class Method Details
.render(component_name, props, prerender_options) ⇒ String
Check a renderer out of the pool and use it to render the component.
25 26 27 28 29 |
# File 'lib/react/server_rendering.rb', line 25 def self.render(component_name, props, ) @@pool.with do |renderer| renderer.render(component_name, props, ) end end |
.reset_pool ⇒ void
This method returns an undefined value.
Discard the old ConnectionPool & create a new one. This will clear all state such as loaded code, JS VM state, or options.
15 16 17 18 |
# File 'lib/react/server_rendering.rb', line 15 def self.reset_pool = { size: pool_size, timeout: pool_timeout } @@pool = ConnectionPool.new() { self.renderer.new(self.) } end |
.with_renderer ⇒ Object
Yield a renderer for an arbitrary block
32 33 34 |
# File 'lib/react/server_rendering.rb', line 32 def self.with_renderer @@pool.with { |renderer| yield(renderer) } end |