TideSDK是否可以使用Ruby脚本中的javascript方法?
TideSDK是否可以处理类似于以下内容的操作:TideSDK是否可以使用Ruby脚本中的javascript方法?,javascript,ruby,tidesdk,Javascript,Ruby,Tidesdk,TideSDK是否可以处理类似于以下内容的操作: <script type="text/javascript"> function foo(answer) { $('#the_answer').text(answer) } </script> <script type="text/ruby"> class Bar def bar() [ .... do some lengthly analysis .... ]
<script type="text/javascript">
function foo(answer) {
$('#the_answer').text(answer)
}
</script>
<script type="text/ruby">
class Bar
def bar()
[ .... do some lengthly analysis .... ]
@the_found_answer = 42
foo(@the_found_answer)
end
window.bar = Bar.new()
我需要做一些事情,比如:
the_window = Ti.UI.getMainWindow()
the_domwindow = the_window.getDOMWindow()
the_domwindow.foo(@the_found_answer)
,对吗?(我没有找到任何其他方法来获得DOM窗口。)tnarik-应该是可行的。你有没有看过这里:
我使用该文档作为参考(加上一些旧的Tianium Developer文档),但没有看到任何关于变量的提及。但它帮助我意识到范围不见了。我不确定这是否是最好的方法(我的意思是更新的代码)。
the_window = Ti.UI.getMainWindow()
the_domwindow = the_window.getDOMWindow()
the_domwindow.foo(@the_found_answer)