As with openfin we can have separate widgets/windows opened separately, how do they communicate with each other ,searched a lot couldn't find anything on this, please help.
Asked
Active
Viewed 263 times
1 Answers
0
You can share a context from main window to all its parent view using customContext
In Window (frame)
const me = fin.Window.getCurrentSync();
me.on('options-changed', async (event) => {
if (event.diff.customContext) {
const myViews = await me.getCurrentViews();
const customContext = event.diff.customContext.newVal;
myViews.forEach(v => {
v.updateOptions({ customContext });
});
}
})
in View (content)
const me = fin.View.getCurrentSync();
const broadcastContext = async (customContext) => {
const myWindow = await me.getCurrentWindow()
await myWindow.updateOptions({ customContext })
};
const addContextListener = async (listener) => {
await me.on('options-changed', (event) => {
if (event.diff.customContext) {
listener(event.diff.customContext.newVal);
}
});
}
References - https://cdn.openfin.co/docs/javascript/stable/tutorial-customContext.html

Varun Goel
- 435
- 2
- 7