[英]How to install library 'When' in Javascript
I have got 2 files: index.html and index.js.我有 2 个文件:index.html 和 index.js。 I am using them to try and do autobahn communication.
我正在使用它们来尝试进行高速公路通信。 Autobahn works, but 'When' doesn't work.
高速公路可以工作,但“何时”不起作用。
I have used bower to download and install Autobahn, and then manually included autobahn.js from withing the html.我使用 bower 下载并安装了 Autobahn,然后从 html 中手动包含 autobahn.js。 I have done the same for When, but an error appears in the When library.
我对 When 做了同样的事情,但是在 When 库中出现了一个错误。
Index.html:索引.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Testing Autobahn</title>
</head>
<body>
<p> Fancy paragraph! </p>
<!--Bower-->
<script src="./bower_components/module/module.js"></script>
<script src="./bower_components/autobahn/autobahn/autobahn.min.js"></script>
<script src="./bower_components/when/when.js"></script>
<!--Node.js-->
<!--<script src="./node_modules/autobahn/lib/autobahn.js"></script>-->
<!--Browserify-->
<!--<script src="./bundle.js"></script>-->
<!--The actual main script file-->
<script type="text/javascript" src="index.js"></script>
</body>
</html>
When I open index.html in a web browser I get the following:当我在 web 浏览器中打开 index.html 时,我得到以下信息:
Found the answer.找到了答案。 The deal was to install the libraries using npm.
交易是使用 npm 安装库。 After that in the node-modules folder there are 2 folders containing the libs: 1) autobahn-browser 2) when
之后在 node-modules 文件夹中有 2 个包含库的文件夹:1)高速公路浏览器 2)当
After including them like this it worked like a charm:在像这样包含它们之后,它就像一个魅力:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.