Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我几乎是钛、iPhone 和 JS 开发的新手,我不知道如何在选项卡组中从一个 .js 调用一个函数到另一个 .js。我在 app.js 中有一个回调,我想从选项卡组中的另一个 .js 调用一个函数。我该怎么做?谢谢
你可以做两件事:
1> 您可以将该函数传递到一个窗口,您可以从该窗口调用该函数。
2> 您可以使用自定义 addEventListener 从另一个窗口调用,如下所示。
应用程序.js
function test(){ alert('Hello from Function'); Ti.App.addEventListener('callTest',test); }
===================另一个.js
Ti.App.fireEvent('callTest');