al6x / synchronize

Write asynchronous code as if it's synchronous
http://alexeypetrushin.github.com/synchronize
316 stars 57 forks source link

Not pausing as expected #57

Open boxxa opened 7 years ago

boxxa commented 7 years ago

I am trying to wrap a function out of the talib library for the talib.execute(). Example code is https://github.com/oransel/node-talib/blob/master/examples/sma.js

Here is my function with synchronize and can't seem to get it to wait. emaData returns undefined and then the "EMA Function Done." message hits after. What am I missing with the sync wrapper?

`sync(talib, "execute")

var emaData = sync.fiber(function(){ talib.execute({ name: "EMA", startIdx: 0, endIdx: series.length - 1, inReal: series, optInTimePeriod: 3 }, function (err, result) { console.log("EMA Function Done."); return result }); return emaData }) console.log(emaData) `

l3laze commented 7 years ago

Not sure, but I think this project is dead -- been trying to use it with a few different async libraries and it just keeps failing. And considering the last commits to master were a year ago that's a good sign it's been abandoned just like most JS fads.