Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Scope of Changes
pulse()
behavior to match that ofpulseOnce()
-- issuing a single pulse to the LEDpulseOnce()
,isPulsing()
, andstopPulsing()
Rationale -- pulsing has been a very unreliable operation in Node.js (at least the way it was implemented). When pulsing continuously, the event loop of Node.js is blocked during the LED pulse. That meant the only time available for processing other things, such as the callback used in
tj.listen()
, was between pulses. This made for a bad user experience; the intent ofpulse()
was to show feedback that TJBot was listening, but by the nature of it's implementation, it wasn't able to listen during thepulse()
, causing spoken input to be ignored. Removing the statefulpulse()
and changing it to a single issuance of a pulse (i.e. whatpulseOnce()
did), makes it a bit safer to use this method in conjunction with other methods that have callbacks.Note: accepting this PR will cause a breakage in recipes that rely on the existing API (at least where pulsing is concerned). I recommend we bump TJBotLib to v1.3 to indicate the lack of backwards compatibility with the v1.2.x series.