Description
The window.__gpp_msghandler references in the example stub code assumes that all commands support a callback parameter, though most commands do not support a callback parameter. The documentation for the getGPPData command describes the callback parameter as "not used".
If these commands only support synchronously returning the value directly without using a callback, how can an asynchronous postmessage interface work?
Similarly, the addEventListener command returns an EventListener object immediately, then uses the callback for any future state changes. When calling the CMP from inside an iframe, only the callbacks would trigger responses to the caller. So, they would not receive the initially returned EventListener object. This means the caller can't tell if the CMP has loaded and therefore won't call the callback, or if it is still loading and the callback will be called once loaded.