If you by any chance still have jQuery and use things like bootstrapSwitch, you can meet this situation:
When switch is setup like this
you immediately can observe that
switchChange is fired. Which could be normal, not a big deal. But if you have system of several dependent toggles - it could lead to infinite loop or circular dependencies.
In my situation, I needed to differentiate between User Related event, when user clicks to the toggle in UI, and code event, when I set value in code. In the second case, I don't need to do additional actions (say, set object.changed = true).
It could be solved by using the third
$('id').bootstrapSwitch('state', true, true)
true as third parameter notifies underlying code that you don't need to fire event right now.
p.s. this is one of such things, when you feel like there is simple solution, but spent about several hours to understand what is it.