Giter Site home page Giter Site logo

invoke's People

Contributors

ded avatar repeatingbeats avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

renatodex

invoke's Issues

Invoke for Javascript Clientside

Hi!

I was wondering..

Its possible to implement Invoke running in a browser? (without NodeJS, only javascript client)
It would be interesting!

Thanks

Add methods that operate on arrays of functions

invoke has nice syntax for controlling the flow of individual anonymous functions, but it lacks semantics for operating on arrays of functions.

I'm currently thinking of an API that looks like:

// batch of sequential functions
invoke(batch).sequentially().rescue(function (err) {
  // error handler
}).end(initial, function (results) {
 // success handler
});

// batch of parallel functions
invoke(batch).inParallel().rescue(function (err) {
  // error handler
}).end(initial, function (results) {
  // success handler
});

// complex flow
invoke(function (data, callback) {
  // ...
}).then(sequentialBatch).sequentially().then(function (data, callback) {
 // ...
}).then(parallelBatch).inParallel().rescue(function (err) {
  // error handler
}).end(initial, function (results) {
  // success handler
});

rescue called n times - not once

example:

var invoke = require('./../lib/invoke')
, start

// Parallel execution of three slow async functions
start = Date.now()

invoke(function (data, callback) {
setTimeout(function(){ callback('error 1') }, 100)
}).and(function (data, callback) {
setTimeout(function(){ callback('error 2') }, 100)
}).and(function (data, callback) {
setTimeout(function(){ callback('error 3') }, 100)
}).rescue(function (err) {
console.error(err)
}).end(null, function (data) {
console.log('Parallel execution took: ' + (Date.now() - start))
})

Result: resque called 3 times, not once
error 1
error 2
error 3

To fixed put this line to top (in invoke.js)
78: if (self._err) return
after 71: fn(passed, function (err, data) {

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.