Giter Site home page Giter Site logo

Comments (4)

s0nspark avatar s0nspark commented on September 26, 2024

Ok, a bit more trial and error yielded an answer...

  task(
    'someTask'
    ->
      // async task code goes here
      complete()
    true
  )

The parens along with multiline indentation does the trick.

I hate having to use those parens, though, so a suggestion in light of this... Perhaps jake could have a separate function for creating asynchronous tasks named 'asynctask'? In addition to removing the need for one to specify whther a task was asynchronous it would also add clarity for anyone reading the Jakefile as asynchronous tasks would stand out more.

  desc 'a normal, synchronous task'
  task 'doStuffButMakeThemWait', ->
    // synchronous task code goes here

  desc 'an asynchronous task'
  asynctask 'doStuffTheNodeWay', ->
    // asynchronous task code goes here

Just a thought...

from jake.

mde avatar mde commented on September 26, 2024

I'll be happy to add this to the docs if you make it a separate patch that doesn't make changes to the Jake API.

from jake.

mde avatar mde commented on September 26, 2024

No forward motion on this one, closing.

from jake.

euskode avatar euskode commented on September 26, 2024

@s0nspark did you figure out what the syntax should be for an async task in coffeescript that also has pre-requisites?

I tried your suggested format above, to no avail. I have so far followed the task signature strictly, ordering things correctly, but this one just doesn't seem to want to work.

What I have right now is essentially this:

task 'taskName', ['myPrereqTask'], ->
    # async code here, calling complete() when done
, {async: true}

I can't really see anything wrong and was hoping to get your thoughts on this!

UPDATE: actually, see @mde's response here. It sems like when using invoke, you have to manage quite a bit of stuff yourself! So my issue isn't really one of syntax, I don't believe.

from jake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.