Really simple promises library
This is a very simple promises library I wrote in an afternoon, mainly after reading https://gist.github.com/3889970. I wanted to implement them out of curiosity, but it turned out to be a little harder than I thought.
I haven't set out to replicate CommonJS promises (Promises/A, B, etc.), but IMHO, this library has got the gist of it (i.e. chaining promises & capturing error handlers downstream).
A naive file copy example:
fs = require 'fs'promqueen = require 'promqueen'promoteNodeCallback = promqueenpromoteNodeCallbackreadFile = promoteNodeCallbackfsreadFilewriteFile = promoteNodeCallbackfswriteFilereadFile__filenamethendatatoStringthenwriteFile 'temp.txt'resultfailthrow err
On my PC, I read a file into memory & wrote it a file 200,000 times using both callbacks & promises, and the difference in performance is negligible.
To run the benchmark: