[core][js] don’t forget to define the function as generator