Request API
Request messages are sent when the plugin requests siibra-explorer to do something on its behalf.
Be it request the user to select a region, a point, navigate to a specific location etc.
Please note that
beforeunloadwindow event does not fire on iframe windows. Plugins should do whatever cleanup it needs, then send the messagesxplr.exit.
let parentWindow
window.addEventListener('message', msg => {
const { source, data, origin } = msg
const { id, method, params, result, error } = data
if (method === "sxplr.init") {
parentWindow = source
}
})
window.addEventListener('pagehide', () => {
// do cleanup
// n.b. since iframe unload usually do not trigger DOM events
// one will need to manually trigger destroying any apps manually
parentWindow.postMessage({
jsonrpc: '2.0',
method: `sxplr.exit`,
params: {
requests: [] // any remaining requests to be carried out
}
})
})
API
| event name | initiator | request | response |
|---|---|---|---|
| sxplr.addAnnotations | client | jsonschema | jsonschema |
| sxplr.cancelRequest | client | jsonschema | jsonschema |
| sxplr.exit | client | jsonschema | jsonschema |
| sxplr.getAllAtlases | client | jsonschema | jsonschema |
| sxplr.getSupportedParcellations | client | jsonschema | jsonschema |
| sxplr.getSupportedTemplates | client | jsonschema | jsonschema |
| sxplr.getUserToSelectARoi | client | jsonschema | jsonschema |
| sxplr.loadLayers | client | jsonschema | jsonschema |
| sxplr.navigateTo | client | jsonschema | jsonschema |
| sxplr.removeLayers | client | jsonschema | jsonschema |
| sxplr.rmAnnotations | client | jsonschema | jsonschema |
| sxplr.selectAtlas | client | jsonschema | jsonschema |
| sxplr.selectParcellation | client | jsonschema | jsonschema |
| sxplr.selectTemplate | client | jsonschema | jsonschema |
| sxplr.setAuxMeshAlpha | client | jsonschema | jsonschema |
| sxplr.setOctantRemoval | client | jsonschema | jsonschema |
| sxplr.updateLayers | client | jsonschema | jsonschema |