How to change dock icons?

I want to add different badge indicators on the dock bar based on the different states of the application. How can I do this?

It sounds like badgeLabel is the API you're looking for.

How to change dock icons?
 
 
Q