在我的 gwt 项目上。我有一个调用字典的脚本:
<script type="text/javascript" src=conf/iw_dictionary.js></script>
而不是将此脚本元素写入 html 文件中。我想在模块加载时将其从入口点注入到 html 中。
我该怎么做?
Use com.google.gwt.core.client.ScriptInjector
,因为它是专门为这样的东西创建的
ScriptInjector.fromUrl("conf/iw_dictionary.js").setCallback(
new Callback<Void, Exception>() {
public void onFailure(Exception reason) {
Window.alert("Script load failed.");
}
public void onSuccess(Void result) {
Window.alert("Script load success.");
}
}).inject();
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)