Giter Site home page Giter Site logo

pspeter3 / concurrent Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 1.0 436 KB

Promises/A+ with Scala Awesomeness

Home Page: http://pspeter3.com/blog/2013/08/27/concurrent-performant-promises-aplus-with-scala-awesomeness/

License: MIT License

JavaScript 100.00%

concurrent's People

Contributors

pspeter3 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

Forkers

ralic

concurrent's Issues

Add wrap static method to Future

The wrap method will wrap a traditional async call. The naive syntax of

var f = Future.wrap(fs.readFile, 'test.txt');

works when the callback is called with (err, value) but does not work on multiple value callbacks like request. That may need a configuration object. What do you think @mattpowell?

Add better custom error types

Custom error types would allow a semblance of pattern matching on failed futures which would help debug if a long chain of futures was rejected. Some example errors are

  • #ready with TimeoutException
  • #filter with PredicateException

Add sequence method to compose multiple futures

Here is an example api

With arrays

var a = new Future();
var b = new Future();
var c = Future.sequence([a, b]);

c.map(function(values) {
  console.log(values); // [a`, b`]
});

With objects

var a = new Future();
var b = new Future();
var c = Future.sequence({
  a: a, 
  b: b
});

c.map(function(values) {
  console.log(values); // {a : a`, b: b`}
});

Find shims for node specific utilities

Create a build script to compile the library for the browser

  • Replace next to use setTimeout
  • Replace util, specifically inherits and isArray dependency
  • Replace forEach in collections

Add ability to mixin Future methods

This would allow the sugar syntax to be included into an existing promise implementation. I'm not sure how the construction of promises from other implementations would work. It may be easier to just create a new future and map the values to the then method results.

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.