Closed Hareramrai closed 4 years ago
I was trying to use the compile method but it's not working.
I was trying the code from below git repo & it was working in that application but not working with opal-rails.
https://github.com/ruby/TryRuby/blob/master/source/javascripts/try_ruby.js.rb#L248
Document.ready? do editor = Element.find("#editor") puts editor Element.find("#btn_run").on(:click) { do_run } def do_run editor = Element.find("#editor") puts editor.value eval_code Opal.compile(editor.value, source_map_enabled: false) end end
This is the error, I am getting in the browser.
kernel:536 Uncaught constructor {name: "compile", message: "undefined method `compile' for Opal", args: Array(2), stack: "compile: undefined method `compile' for Opal↵ a…2910799d5a1ca4cdef24042b571d8a.js?body=1:4992:28)"}
Please help me with this issue.
I got it working after importing require "opal-parser".
require "opal-parser"
I was trying to use the compile method but it's not working.
I was trying the code from below git repo & it was working in that application but not working with opal-rails.
https://github.com/ruby/TryRuby/blob/master/source/javascripts/try_ruby.js.rb#L248
This is the error, I am getting in the browser.
Please help me with this issue.