async function retryOnPageUnload (namespace, identifier, args, func, timeout = 500) {
  const unloadPromise = watchForPageUnload(timeout)

  func()

  try {
    await unloadPromise
  } catch (e) {
    if (e !== 'unload') {
      throw e
    }

    runAfterPageLoad(namespace, identifier, args)
  }
}
Monitors the page for unload events for a specified timeout after calling the supplied function.
If the page unloads before the timeout expires the function call is recorded in session storage and
can be loaded with `getPageUnloadRetriesForNamespace`.  The function is not automatically rerun,
it is the responsibility of the consumer to check for retries and to call the function again.

This is useful for situations where an ongoing process (like a network call) may be interrupted by
a reload.  For example, a tracking network call that is fired after successful login, right before
the user is redirected to the dashboard.