Sha256: 0585473a6cf4b283235a32316227714a4a6986f158a69f8c8618408de8ab00cc

Contents?: true

Size: 842 Bytes

Versions: 6

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

require "connection_pool"
require_relative "server_rendering_pool/ruby_embedded_java_script"

# Based on the react-rails gem.
# None of these methods should be called directly.
# See app/helpers/react_on_rails_helper.rb
module ReactOnRails
  module ServerRenderingPool
    class << self
      def pool
        @pool ||= if ReactOnRails::Utils.react_on_rails_pro?
                    ReactOnRailsPro::ServerRenderingPool::ProRendering
                  else
                    ReactOnRails::ServerRenderingPool::RubyEmbeddedJavaScript
                  end
      end

      delegate :reset_pool_if_server_bundle_was_modified, :reset_pool, to: :pool

      def server_render_js_with_console_logging(js_code, render_options)
        pool.exec_server_render_js(js_code, render_options)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
react_on_rails-11.0.9 lib/react_on_rails/server_rendering_pool.rb
react_on_rails-11.0.8 lib/react_on_rails/server_rendering_pool.rb
react_on_rails-11.0.7 lib/react_on_rails/server_rendering_pool.rb
react_on_rails-11.0.6 lib/react_on_rails/server_rendering_pool.rb
react_on_rails-11.0.5 lib/react_on_rails/server_rendering_pool.rb
react_on_rails-11.0.4 lib/react_on_rails/server_rendering_pool.rb