• <bdo id='c7qEs'></bdo><ul id='c7qEs'></ul>

        <small id='c7qEs'></small><noframes id='c7qEs'>

        <legend id='c7qEs'><style id='c7qEs'><dir id='c7qEs'><q id='c7qEs'></q></dir></style></legend>
      1. <i id='c7qEs'><tr id='c7qEs'><dt id='c7qEs'><q id='c7qEs'><span id='c7qEs'><b id='c7qEs'><form id='c7qEs'><ins id='c7qEs'></ins><ul id='c7qEs'></ul><sub id='c7qEs'></sub></form><legend id='c7qEs'></legend><bdo id='c7qEs'><pre id='c7qEs'><center id='c7qEs'></center></pre></bdo></b><th id='c7qEs'></th></span></q></dt></tr></i><div id='c7qEs'><tfoot id='c7qEs'></tfoot><dl id='c7qEs'><fieldset id='c7qEs'></fieldset></dl></div>
        <tfoot id='c7qEs'></tfoot>

      2. 如何在 coffeescript 中启用和声语法支持?

        时间:2024-04-19
        <legend id='0SznL'><style id='0SznL'><dir id='0SznL'><q id='0SznL'></q></dir></style></legend>

          <bdo id='0SznL'></bdo><ul id='0SznL'></ul>
          1. <i id='0SznL'><tr id='0SznL'><dt id='0SznL'><q id='0SznL'><span id='0SznL'><b id='0SznL'><form id='0SznL'><ins id='0SznL'></ins><ul id='0SznL'></ul><sub id='0SznL'></sub></form><legend id='0SznL'></legend><bdo id='0SznL'><pre id='0SznL'><center id='0SznL'></center></pre></bdo></b><th id='0SznL'></th></span></q></dt></tr></i><div id='0SznL'><tfoot id='0SznL'></tfoot><dl id='0SznL'><fieldset id='0SznL'></fieldset></dl></div>

                <small id='0SznL'></small><noframes id='0SznL'>

                  <tbody id='0SznL'></tbody>

                • <tfoot id='0SznL'></tfoot>
                  本文介绍了如何在 coffeescript 中启用和声语法支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我使用带有 --harmony 标志的 node.js(0.11.13) 并使用了 function *()yield 关键字.

                  I used node.js(0.11.13) with --harmony flag and used function *() and yield keywords.

                  我尝试借助 coffeescript 简化我在 node.js 上的开发,到目前为止它运行良好,但我遇到了 yield 和声明生成器的麻烦 - 它抱怨 'reserved关键字产量'.

                  I tried to simplify my development on node.js with help of coffeescript, so far it works great but I went into troubles with yield and declaring a generator - it complains about 'reserved keyword yield'.

                  有什么想法吗?

                  推荐答案

                  另一种打开黑色次元之门的方法是:

                  Another way to open the gate to the black dimension is:

                  co = require 'co'
                  sleep = require 'co-sleep'
                  
                  co(`function*(){1`
                      console.log 'hi!'
                      `yield sleep(1000)`
                      console.log 'bye!'
                  `1}`)()
                  

                  这似乎是完全有效的咖啡脚本,不过,webstorm cofeescript 插件会抱怨错误,但它可以工作.

                  It's seems to be perfectly valid coffee-script, though, webstorm cofeescript plugin cries about errors, but it works.

                  以下解决方案(vanilla coffeescript 和 gulp)也是可能的:

                  Also the following solution(vanilla coffeescript and gulp) is possible:

                  co      = require 'co'
                  sleep   = require 'co-sleep'
                  $       = (cor) -> cor
                  $yield  = (cor) -> cor
                  
                  do co $ ->
                      console.log "hi!"
                      $yield sleep(1000)
                      console.log "bye!"
                  
                  gulp.task 'node-js', ->
                      gulp.src config.srcServerJs, {base: config.srcServerJsBase}
                      .pipe plumb()
                      .pipe coffee()
                      .pipe replace(/$(function(/g, '$(function*(')
                      .pipe replace(/$yield(/g, 'yield (')
                      .pipe gulp.dest(config.dstServerJs)
                  

                  魔术:IDE 中没有错误 :)

                  magic: no errors in IDE :)

                  更新在尝试并阅读了很多关于咖啡、ecma6 及其未来的资料后,我决定放弃咖啡脚本并使用 ECMA6 支持 node.js 和客户端的 traceur

                  Update After trying and reading a lot of stuff about coffee, ecma6 and its future I decided to give up on coffeescript and go with ECMA6 with support of traceur for both node.js and client-side

                  这篇关于如何在 coffeescript 中启用和声语法支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Javascript 中 with 语句的未来 下一篇:Mongoose:Coffeescript 中的递归嵌入文档

                  相关文章

                      <bdo id='OGoNG'></bdo><ul id='OGoNG'></ul>

                      <i id='OGoNG'><tr id='OGoNG'><dt id='OGoNG'><q id='OGoNG'><span id='OGoNG'><b id='OGoNG'><form id='OGoNG'><ins id='OGoNG'></ins><ul id='OGoNG'></ul><sub id='OGoNG'></sub></form><legend id='OGoNG'></legend><bdo id='OGoNG'><pre id='OGoNG'><center id='OGoNG'></center></pre></bdo></b><th id='OGoNG'></th></span></q></dt></tr></i><div id='OGoNG'><tfoot id='OGoNG'></tfoot><dl id='OGoNG'><fieldset id='OGoNG'></fieldset></dl></div>

                      <small id='OGoNG'></small><noframes id='OGoNG'>

                      <tfoot id='OGoNG'></tfoot>
                    1. <legend id='OGoNG'><style id='OGoNG'><dir id='OGoNG'><q id='OGoNG'></q></dir></style></legend>