ericandrewlewis / speach

0 stars 2 forks source link

General feedback wanted #1

Open ericandrewlewis opened 6 years ago

ericandrewlewis commented 6 years ago

I made this for a few reasons outlined in the readme. I think there should be a wrapper around the Speech Synthesis API, but I'm not sure the API I created is great.

If you have any feedback on what I've built I would love to hear it! A few questions from me:

Thanks for looking! 💫

ericandrewlewis commented 6 years ago

I'm exposing a .then() method which provides direct input into that promise chain. Does this make sense? I'm worried this might be breaking a fundamental property of promises.

I stumbled upon superagent this evening and noticed they employ a similar pattern in their API. You can chain configuration and call .then() which is invoked after the HTTP response comes back.

 request
   .post('/api/pet')
   .send({ name: 'Manny', species: 'cat' })
   .set('X-API-Key', 'foobar')
   .set('Accept', 'application/json')
   .then(function(res) {
      alert('yay got ' + JSON.stringify(res.body));
   });