pspeter3 / concurrent Goto Github PK
View Code? Open in Web Editor NEWPromises/A+ with Scala Awesomeness
Home Page: http://pspeter3.com/blog/2013/08/27/concurrent-performant-promises-aplus-with-scala-awesomeness/
License: MIT License
Promises/A+ with Scala Awesomeness
Home Page: http://pspeter3.com/blog/2013/08/27/concurrent-performant-promises-aplus-with-scala-awesomeness/
License: MIT License
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?
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
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`}
});
Executes a function that returns a new future
Create a build script to compile the library for the browser
setTimeout
util
, specifically inherits
and isArray
dependencyforEach
in collections
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.