COMB

Parent window

<script type="text/javascript" src="./holo_hosting_comb.js"></script>
<script type="text/javascript">
(async () => {
    const child = await comb.connect( url );

    await child.set("mode", mode );

    let response = await child.run("signIn");
})();
</script>

Child frame

<script type="text/javascript" src="./holo_hosting_comb.js"></script>
<script type="text/javascript">
(async () => {
    const parent = comb.listen({
        "signIn": async function ( ...args ) {
            if ( this.mode === DEVELOP )
                ...
            else
                ...
            return response;
        },
    });
})();
</script>
Source:

Classes

ChildAPI
ParentAPI

Methods

(async, inner) connect(url) → {ChildAPI}

Insert an iframe (pointing at the given URL) into the document.body and wait for COMB to connect.

Parameters:
Name Type Description
url string

URL that is used as 'src' for the iframe

Source:
Example
const child = await COMB.connect( "http://localhost:8002" );

(inner) debug(level)

Turn on debugging and set the logging level. If 'debug' is not called, the default log level is 'error'.

Parameters:
Name Type Description
level string

Log level (default: "debug", options: "error", "warn", "info", "debug", "trace")

Source:
Example
COMB.debug( "info" );

(async, inner) listen(methods) → {ParentAPI}

Listen to 'postMessage' requests and wait for a parent window to connect.

Parameters:
Name Type Description
methods object

Functions that are available for the parent to call.

Source:
Example
const parent = await COMB.listen({
    "hello": async function () {
        return "Hello world";
    }
});