class ReactOnRails::ServerRenderingPool::RubyEmbeddedJavaScript
def console_polyfill
Reimplement console methods for replaying on the client
def console_polyfill <<~JS var debugConsole = console; var console = { history: [] }; ['error', 'log', 'info', 'warn'].forEach(function (level) { console[level] = function () { var argArray = Array.prototype.slice.call(arguments); if (argArray.length > 0) { argArray[0] = '[SERVER] ' + argArray[0]; } console.history.push({level: level, arguments: argArray}); }; }); JS end