Skip to content

Expose packaged XDM files#108

Open
gburning wants to merge 1 commit intomicrosoft:masterfrom
gburning:master
Open

Expose packaged XDM files#108
gburning wants to merge 1 commit intomicrosoft:masterfrom
gburning:master

Conversation

@gburning
Copy link
Copy Markdown

At the moment the XDM files are packaged but not included in the manifest. I'd like to be able to import the channelManager that was previously exposed by the package as I need to bridge the gap between an iframe my extension loads and the parent channel.

Here's the code for my use case:

/**
 * Bridge XDM channel of child window (iframe) to host/parent window's channel.
 * This allows the loaded iframe to access the DevOps SDK as if it was loaded directly (with some caveats).
 */
function createChannelBridge(childWindow: Window) {
    const parentChannel = channelManager.addChannel(window.parent)
    const childChannel = channelManager.addChannel(
        childWindow,
        childWindow.origin
    )

    const childRegister = childChannel.getObjectRegistry()

    childRegister.register(
        'DevOps.HostControl',
        parentChannel.getRemoteObjectProxy('DevOps.HostControl')
    )

    childRegister.register('DevOps.ServiceManager', {
        getService,
    })
}

Ideally you would also export the hostControlId and serviceManagerId constants from the SDK file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant