![](/img/trans.png)
[英]How and where does the `require_table` variable get stored? (OpalRb)
[英]Why does `require 'native'` throw an exception in opalrb?
我正在使用opalrb
采取嬰兒步驟,這是我的main.rb
:
require 'native'
def main
puts "hi from the main function in main.rb"
end
def demoButton
outputDiv = Element.find('output').get(0)
puts outputDiv.methods.sort
end
它包含在<head>
之后opal.js
和...opal-parser.js" onload="Opal.load('opal-parser')"
但控制台顯示拋出異常:
{
message: "cannot load such file -- native",
name: "LoadError",
stack: ""
}
native
似乎是 opal 標准庫的一部分,那么為什么包含它會出現問題呢?
添加這個:
<script src="https://cdn.opalrb.com/opal/current/native.js"></script>
Opal 的 stdlib 部分(如原生)不包含在opal.js
。 有關 stdlib 的完整列表,請查看此處:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.