My decision between `switch` and this was based on MDN article [Communicating using "postMessage"] [1]. Current implementation is shorter and more readable than `switch`, IMHO.



[1]: https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/Content_Scripts/using_postMessage#Message_Events_Versus_User-Defined_Events "Message Events Versus User-Defined Events"