add the spawn function for ES6 generators
Merge pull request #306