oransel / node-talib

A technical analysis library for node.js
GNU Lesser General Public License v3.0
904 stars 149 forks source link

supporting synchronized call and fix running in child thread #75

Closed z-hao-wang closed 5 years ago

z-hao-wang commented 5 years ago

see readme examples

z-hao-wang commented 5 years ago

this also fixes context issue when running in child processes. https://github.com/nodejs/node/issues/21481

danielsokolowski commented 5 years ago

This looks good to me, can it be merged in?

z-hao-wang commented 5 years ago

@danielsokolowski the example are in the readme, you can avoid using a callback. The original purpose is that I have to work with a different lib that doesn't support callback type calls. Also this enables to run in forked child thread.

oransel commented 5 years ago

May be the sync functions need to be separate than the async functions so we don't loose the async functionality

z-hao-wang commented 5 years ago

@oransel I believe this change is fully backward compatible, it will use async method if you pass in a callback, otherwise it will do sync call. how else could we separate the sync methods?

oransel commented 5 years ago

@z-hao-wang Sounds good. If you can resolve the merge conflicts, i can pull in and test.

z-hao-wang commented 5 years ago

@oransel Just merged conflicts and test on my side worked.