Skip to content

Commit

Permalink
Fixes server rendering with polyfill
Browse files Browse the repository at this point in the history
Caused by issue:
reduxjs/redux#1335
  • Loading branch information
DannyMay9082 committed Jan 31, 2016
1 parent 3947e1d commit 26e994f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/react_on_rails/server_rendering_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def create_js_context
bundle_js_code = File.read(server_js_file)
base_js_code = <<-JS
#{console_polyfill}
#{execjs_timer_polyfills}
#{bundle_js_code};
JS
begin
Expand Down Expand Up @@ -102,6 +103,18 @@ def create_js_context
end
end

def execjs_timer_polyfills
<<-JS
function setInterval() {
conosle.error('setInterval is not defined for execJS. See https://github.com/sstephenson/execjs#faq');
}
function setTimeout() {
conosle.error('setTimeout is not defined for execJS. See https://github.com/sstephenson/execjs#faq');
}
JS
end

# Reimplement console methods for replaying on the client
def console_polyfill
<<-JS
Expand Down

0 comments on commit 26e994f

Please sign in to comment.