Skip to content

Example GPP JS API stub code assumes all commands support callbacks but they don't #46

Closed
@nealrosen

Description

@nealrosen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions