Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @interface-technologies/check-for-js-bundle-update-saga

Index

Functions

checkForJsBundleUpdateSaga

  • Periodically fetches / (index.html) to check if a new JavaScript bundle has been released.

    If the bundle has been updated, the user is prompted to refresh the page. After 3 alerts are shown, the page is forcibly refreshed.

    Don't enable this in development!

    Your index.html must contain a script tag like:

    <script src="app.23e590a23b49.js"></script>
    

    or

    <script src="dist/app.js?v=Gq0JHtehvL9fMpV"></script>
    

    checkForJsBundleUpdateSaga will compare the src attribute of the script tag.

    An example of using checkForJsBundleUpdateSaga from your TypeScript code:

    export function* myCheckForJsBundleUpdateSaga(): SagaIterator<void> {
    if (process.env.NODE_ENV === 'development') return

    function onError(e: unknown): void {
    console.error(e)
    Bugsnag.notify(e)
    }

    yield call(checkForJsBundleUpdateSaga, { onError })
    }

    Parameters

    Returns SagaIterator<void>

Generated using TypeDoc