I recently ran into this: there is a webview where user can click Export, and it'll do a
postMessage to the native side to initiate the export. The export happens in native side - traversing the JSON document, making Network requests etc. The Webview is a pure React component, and it does not have any state and doesn't do any work.
The export is long-running: it makes several HTTP calls to upload images to S3. The user can close the Webview while this is happening, but the requests will continue to run and update the viewState (which is maintained in the native side). If the user starts the Plugin again, while the requests are ongoing, I want to show them the current state of the upload, and prevent them from re-initiating the export while one is happening.
global was useful here since it maintains the viewState irrespective of whether the webview is active or not.