synchronize icon indicating copy to clipboard operation
synchronize copied to clipboard

Synchronize functions which are declared in the main module

Open neimanpinchas opened this issue 9 years ago • 2 comments

You are giving an example for readFile

sync(fs,"readFile")

I tried to Synchronize functions which i am declaring in the main module.

sync("combo")//does nothing
sync(global,"combo")//global does not contain a function combo
sync(main,"combo")//main does not con....

how should i do that? thanks

neimanpinchas avatar Jun 14 '16 12:06 neimanpinchas

You can use that case like this...

var _ = {};
_.combo = combo;
sync(_, 'combo');
// maybe you need reassign
// combo = _.combo;

But, many case, I use this method instead wrap method.

combo(sync.defer());
sync.await();

d3m3vilurr avatar Jun 16 '16 02:06 d3m3vilurr

that second way is very good, because of the )))))'s at the end of a wrapped sync.await\defer

neimanpinchas avatar Jun 16 '16 15:06 neimanpinchas