@source-health/sourcebridge v0.0.1
SourceBridge Library
:bangbang: | This SDK is still in beta, and may change significantly before its public release. |
---|
The SourceBridge library is a required dependency for customer-built 'frame' plugins that run within the main Source Health web UI.
This SDK is written in TypeScript and compiled to ES6.
Getting Started
Getting started with the Source Health client is easy. First, install the package via NPM:
yarn add @source-health/sourcebridge # or npm install @source-health/sourcebridge
Then, import the SourceBridge API:
import { SourceBridge } from '@source-health/sourcebridge'
Subscribe to context updates from the parent window.
Note: after rendering for the first time, your application must call SourceBridge.ready()
in order to clear the loading state and display the plugin.
await SourceBridge.onContextUpdate(async (context) => {
// Handle the context, set and render your application
await doSomeStuff(context.member)
// Call ready() to clear the loading state for the plugin
SourceBridge.ready()
})
And, finally, kick off the handshake with the parent window (which will lead to the context callback being run):
await SourceBridge.init()
Plugin Developer Documentation
Developer documentation for plugin development will be published shortly. In the meantime, an example plugin is available at source-health/source-demo-frame-plugin.
2 years ago