support sync api (use javascript yield)