event-emitter style wrapper around postMessage