Set a listener to be executed when a View's target Window experiences a context update. Can only be set from a view that has wrapped its current platform. The listener receives the new context as its first argument and the previous context as the second argument. If the listener returns a truthy value, the View's context will be updated with the new context as if Platform.setContext was called. This can only be set once per javascript environment (once per View), and any subsequent calls to onWindowContextUpdate will error out. If the listener is successfully set, returns a promise that resolves to true.
Example
const platform = fin.Platform.getCurrentSync();
const listener = (newContext, oldContext) => {
console.log(`The window context has been updated to ${newContext} from the old context of ${oldContext}. Handle View context update here.`)
// return true to automatically update view context to newContext
return true;
}
platform.onWindowContextUpdate(listener);