使用Scriptinjector在GWT中命令脚本注入

时间:2017-04-11 07:35:45

标签: gwt javascript-injection

<link rel="stylesheet" href="public/rappid.min.css" />
<script src="public/jquery.js"></script>
<script src="public/lodash.js"></script>
<script src="public/backbone.js"></script>
<script src="public/rappid.min.js"></script>
<link rel="stylesheet" type="text/css" href="public/joint.ui.tooltip.min.css" />
<script src="public/joint.ui.tooltip.min.js"></script> 

我想要脚本注入的这个顺序,但是当我使用scriptinjector时,它们会被随机加载并给出这样的错误。

backbone.js:382 Uncaught TypeError: Cannot read property 'extend' of undefined(…)(anonymous function) @ backbone.js:382(anonymous function) @           
 backbone.js:31(anonymous function) @ backbone.js:34
ConsoleLogger.java:32 backbone.js Loaded
ConsoleLogger.java:32 jquery.js Loaded
joint.layout.treeLayout.min.js:14 Uncaught ReferenceError: joint is not defined(…)(anonymous function) @ joint.layout.treeLayout.min.js:14
ConsoleLogger.java:32 joint.layout.treeLayout.min.js Loaded
callgraph.js:1 Uncaught ReferenceError: joint is not defined(…)(anonymous function) @ callgraph.js:1
ConsoleLogger.java:32 callgraph.js Loaded
rappid.min.css:15 Uncaught SyntaxError: Unexpected token .
ConsoleLogger.java:32 rappid.min.css Loaded
ConsoleLogger.java:32 lodash.js Loaded
rappid.min.js:43 Uncaught TypeError: Cannot set property '$' of undefined(…)(anonymous function) @ rappid.min.js:43(anonymous function) @ rappid.min.js:50
ConsoleLogger.java:32 rappid.min.js Loaded

1 个答案:

答案 0 :(得分:2)

您必须从回调信号中加载/注入下一个脚本,前一个脚本已准备就绪。