GWT 中的 DOM 就绪 [英] DOM ready in GWT
本文介绍了GWT 中的 DOM 就绪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 GWT 中是否有类似 jquerys ready()
的东西.我添加了一个 iframe 并将检查 DOM 何时准备就绪.
Is there something like jquerys ready()
in GWT. I add an iframe and will check when the DOM is ready.
推荐答案
您可以创建一个 延迟命令在浏览器事件循环返回时执行.
You can create a deferred command to execute when the browser event loop returns.
boolean ready=false;
public void onModuleLoad() {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
ready=true;
Window.alert(ready+"");
}
});
for (int i=0;i<9999;i++){
RootPanel.get().add(new Label(ready+""));
}
}
这个例子在 DOM 上放置了 9999 个标签,只有在此之后才提示 true
This example places 9999 labels at DOM, only after then alerts true
这篇关于GWT 中的 DOM 就绪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文