我正在尝试使用Babel,但它对我来说效果不佳.
我的项目很简单
|-project/
|---src/
|-----index.html
|-----main.js
|-----module.js
|---Gruntfile.js
|---package.json
Run Code Online (Sandbox Code Playgroud)
的index.html
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Test</title>
<script src="main.js" type="application/javascript"></script>
</head>
<body>
<p>Simple html file.</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
main.js
import * as math from "./module";
async function anwser() {
return 42;
}
(function main() {
anwser().then((v) => {
console.info(v);
});
console.log(math.sum(5, 5));
})();
Run Code Online (Sandbox Code Playgroud)
module.js
export function sum(x, y) {
return x + y;
}
Run Code Online (Sandbox Code Playgroud)
Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
"babel": {
"options": {
"sourceMap": true,
"experimental": true
},
dist: …Run Code Online (Sandbox Code Playgroud) 我想向浏览器申请证书以获得身份验证的成员.
在nodejs中我们有类似http://nategood.com/nodejs-ssl-client-cert-auth-api-rest的内容
我已经阅读了一些关于tls的文章,但我真的不明白如何使用它...
我会知道我们是否可以在函数中声明静态var,就像我们在JavaScript中可以做的那样.
当我回调我的函数时,我的变量保留了她最后的做法.
或者我可以只使用全局变量(它不性感......)?