phetsims / utterance-queue

Alerting library powered by aria-live
MIT License
0 stars 2 forks source link

Remove Announcer.clearEmitter #54

Closed jessegreenberg closed 2 years ago

jessegreenberg commented 2 years ago

One of the TODOs from https://github.com/phetsims/joist/issues/752, but it should be its own issue.

The clearEmitter emits from voicingManager.cancel() and a listener on it is in the UtteranceQueue to remove any Utterances that remain in the queue. This was necessary after we made UtteranceQueue responsible for all of the queing work of the Announcer.

In order to support voicingManager.cancel we still need this function. But we are moving away from using the Announcer in usages. Instead I think cancel() and canelUtterance() should be moved to UtteranceQueue, which will forward the implementation of cancelling announcement to the Announcer. This will make the Emitter unecessary

jessegreenberg commented 2 years ago

clearEmitter has been removed and cancel and cancelUtterance have been moved to UtteranceQueue. The only remaining usage of voicingManager.cancelUtterance is in the number-play use case and I think that is about to get removed when we add a separate UtteranceQueue for usages that do not pertain to the Voicing feature.

@zepumph would you like to review this?

zepumph commented 2 years ago

Looks great. thanks