Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronize functions which are declared in the main module #44

Open
neimanpinchas opened this issue Jun 14, 2016 · 2 comments
Open

Synchronize functions which are declared in the main module #44

neimanpinchas opened this issue Jun 14, 2016 · 2 comments

Comments

@neimanpinchas
Copy link

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

@d3m3vilurr
Copy link
Collaborator

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();

@neimanpinchas
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants