Closed hklages closed 3 years ago
I've used a library to specify which events are available, this is how it looks like in VSCode.
So while I'm editing a .js file, that references the complied library, I'm still getting this extra information. I think it doesn't enforce which events you subscribe to.
Can you tell your environment that you're dealing with an object that is an instance of SonosDevice that might give you the same features?
I also use VSCode and the screen is visible - but not so easy to understand for instance ... 6 more ...
Is the following correct:
SonosEvents, from RenderingControl: Mute, Volume but NOT Bass, Treble, Loudness, DialogLevel, SubGain, NightMode
SonosEvents from AVTransportState: CurrentTrackMetaData, CurrentTrackUri, EnqueuedTransportUriMetadata, EnqueuedTransportUri, NextTrackMetadata, NextTrackUri - but not TransportStatus, CurrentPlayMode, CurrentCrossfadeMode, CurrentTransportActions, ...
and you renamed TransportState to CurrentTransportState.
The events part could use some extra explanation, open to PR :wink:. I started somewhere and then I decided that they should be named differently. But renaming the Enums would break existing functionality, and that isn't something I would like to do.
@hklages what do you think about https://github.com/KeesCBakker/Strongly-Typed-Events-for-TypeScript/blob/master/documentation/HowToAddAnEventToAClass.md
That looks like a no more mistakes eventemitter
For me this is not any more an issue: I only use
const { SonosDevice, SonosEventListener } = require('@svrooij/sonos/lib')
and as service serviceEvent
. Thats realy easy - thanks to your package :-)
serviceArray.forEach(async function (serviceName) {
await player[serviceName].Events.on('serviceEvent',
sendServiceMsgs.bind(this, serviceName, eventsByServices[serviceName], outputs))
debug('subscribed to >>%s', serviceName)
})
Then I pick the properties I need, combine them and emit them to Node-RED output lines. Thats all done in sendServiceMsgs
I hope to get more information about interesting use cases and the required properties / what combination during the next months. Then I can give more suggestions about bundling properties to "events".
It is difficult for me to comment the above link - my TypeScript knowledge is not sufficient to understand the impact on stability, reliability.
No idea on how to check. re-open with ideas on how to check
does not provide any error message. Do I have to check the right "name"? Or is there something wrong in the code?