say.js icon indicating copy to clipboard operation
say.js copied to clipboard

Speak and Export methods should be promises

Open tlhunter opened this issue 7 years ago • 3 comments

Both the .speak() and .export() methods should accept a callback or return a promise if the callback is missing.

tlhunter avatar Nov 05 '17 02:11 tlhunter

I love it, just made something like it:

      let getNextSaying = (text) => () => {
        return new Promise(resolve => {
          console.log(`Speaking ${text} ..`)
          say.speak(text, "Good News", 1.0, resolve)
        })
      }

      currentSpeakingIsOver = currentSpeakingIsOver.then(getNextSaying(action.payload))

Also - on Windows I'm not sure the promise truly waits for the first to be over.. It could be the OS reports back sooner than the speech finishes - got any confirmation on that?

deanrad avatar May 23 '18 19:05 deanrad

@deanius I'm unfamiliar with how say works with Windows. Can you create a separate issue?

tlhunter avatar Jun 19 '18 06:06 tlhunter

@tlhunter - Yes I'll try and keep you posted - a few quirks I'm noticing, but don't have a minimal repro yet..

deanrad avatar Jun 19 '18 15:06 deanrad