View Single Post
Old 11-15-2012, 02:49 PM   PM User | #7
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 530 Times in 524 Posts
devnull69 will become famous soon enough
You didn't get me ... technically you can return something from each and every function, but semantically it doesn't make any sense to return something from the callback of an asynchronous method because it will end up "in thin air". The calling method has long finished before the callback is executed so you cannot return anything from it.

So:
Quote:
General rule: Every action that depends on the outcome of an asynchronous method must be run inside the callback of that method or must be called from that callback. Returning anything doesn't make any sense because at the time the callback is run, the outer function has already finished.
devnull69 is offline   Reply With Quote