Using badgeCount in snapped electron apps

Since this took a few days until i had figured it out for an app I am playing with, I thought it makes sense to note it down here in the forum so others can find it with a google search.

If you package an electron app that has the ability to show something like an “Unread Messages” count in its Icon on the Dock, you should make sure to have libunity (for core18 based snaps this is libunity9 to be precise) in your stage-packages:.

With this the necessary dbus bits and pieces will be included in your snap to allow your app to talk to the dock with something like
app.badgeCount = 99.