我将尝试在hostpage中定义一个回调函数,并在onModuleLoad()方法的末尾从GWT调用它。
主机页函数:
<script type="text/javascript">
function onGwtReady() {
loadGallery('blargh');
};
</script>
吉瓦特:
public void onModuleLoad() {
FacebookGallery facebookGallery = new FacebookGallery();
RootPanel.get().add(facebookGallery);
initLoadGallery(facebookGallery);
// Using a deferred command ensures that notifyHostpage() is called after
// GWT initialisation is finished.
DeferredCommand.addCommand(new Command() {
public void execute() {
notifyHostpage();
}
}
private native void notifyHostpage() /*-{
$wnd.onGwtReady();
}-*/