钛 javascript 事件
我一直在使用 Titanium 开发 Android 应用程序,该应用程序通过宁静的 Web 服务发布一些微博。一切正常,但我使用 tabhost 同时存储五个窗口,其中一些窗口使用相同的事件处理程序来获取相同类型的数据。因此,当您从服务器获取某种数据时,来自多个窗口的事件可能会开始工作。这些事件可能会引发其他事件,事情就会变得一团糟。
有没有办法抑制其他对象并只启用焦点对象?我怎样才能防止这种情况发生?
I have been using Titanium for an Android application that does some microblogging through restful web services. Everything works fine, but I am using tabhost to store five windows at the same time and some of these windows use same event handlers to get same kind of data. So when you get some kind of data from server, events from multiple windows may start to work. And these events may fire other events and things got all messed up.
Is there a way to suppress other objects and just enable the object in focus? How can I prevent this situation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我管理此类事情的一种方法是将我的操作挂钩到用户实际打开的窗口的焦点事件。然后使用我需要的任何东西来渲染该窗口。您可能试图在用户实际打开所有窗口之前更新它们。这其实没有必要。等到他们打开窗口然后更新它。只要设置好数据,渲染窗口就会很快,并且可以实时完成,不会有太多延迟。
在移动设备上,你确实必须尝试尽可能晚地做事情。
One way that I managed things like that is to hook my actions to the focus event of the window the user is actually opens. Then use whatever I need to render that window. It might be that you're trying to update all windows before the user is actually opens them. That's not really necessary. Wait until they open the window and then update it. As long as you have the data set up, rendering the window is quick and you can do it realtime and without too much delay.
On a mobile, you really have to try to do things as late as possible.