How can I access a variable in opal-ruby code that was previously defined in javascript? For example, in the following code, how to fix an opal file.
... <script> var test = "hi" </script> ...
Document.ready? do puts test end
Opal allows you to use backticks to output any raw JavaScript that you do not want Opal to interpret, so this will result in the output of a test string containing "hi":
test
Document.ready? do puts `test` end
Source: https://habr.com/ru/post/1445341/More articles:C # Windows Forms ComboBox SelectionChangeCommitted event prevents selection changes when the Combobox BindingSource property has changed in it - winformsHow do I know which tracked accounts were followers of my Twitter account? - ruby | fooobar.comI do not understand this block of Python code. Boolean multiplication with a float? - pythonLibrary for cross-platform (C ++ / Android) lossless compression / decompression / low noise - c ++Sticky scrolling issue in WinRT XAML GridView - paddingSetting obsolete headers and gzipping data via .htaccess - apacheCALayer properties (such as shadows) are not displayed on all UITableViewCells - iosView all messages from WebSphere MQ at a time using Java - ibm-mqUITableViewCell Content Overlap - iosServiceStack ORMLite support for views - c #All Articles