简体   繁体   English

node.js中的“->”是什么意思

[英]What means the “->” in node.js

I'm trying to learn about the connect-livereload module and after installing it, is written this : 我正在尝试了解connect-livereload模块,并在安装后将其编写为:

Next, import: 接下来,导入:

app.configure 'development', ->
  app.use require('connect-livereload') 35729

is that " -> " sign just a typo or what it stands for ? 是“ -> ”符号只是错字还是代表错字? i would suppose it's just a typo if these two lines weren't chained with just a comma so that's why i ask. 我想如果这两条线不是只用逗号链接,那只是一个错字,所以这就是我问的原因。

-> is an operator used in CoffeScript . ->CoffeScript使用的运算符。

Functions are defined by an optional list of parameters in parentheses, an arrow, and the function body. 函数由括号中的可选参数列表,箭头和函数体定义。

reference at coffescript.com 参考在coffescript.com

That's not JavaScript, it's CoffeeScript . 那不是JavaScript,而是CoffeeScript It's a function. 这是一个功能。 The JavaScript translation is: JavaScript的翻译是:

app.configure('development', function() {
    return app.use(require('connect-livereload'), 36729);
});

that is nothing node specific. 这与节点无关。 That code is writting in coffeescript 该代码写在coffeescript中

in javascript that is the same as 在javascript中与

app.configure('development', function() {
  return app.use(require('connect-livereload')(35729));
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM