Make a javascript function yieldable.