How to use the single-spa.unloadApplication function in single-spa

To help you get started, we’ve selected a few single-spa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CanopyTax / single-spa / spec / apps / happy-unload / happy-unload.spec.js View on Github external
.then(() => {
        // First caller to unloadApplication wants to waitForUnmount
        const promise1 = singleSpa.unloadApplication('./happy-unload.app.js', {waitForUnmount: true})

        // Second caller to unloadApplication doesn't want to waitForUnmount
        const promise2 = singleSpa.unloadApplication('./happy-unload.app.js', {waitForUnmount: false})

        return Promise.all([promise1, promise2])
      })
  });
github CanopyTax / single-spa / spec / apps / invalid-unload / invalid-unload.spec.js View on Github external
expect(() => {
      // Trying to unload an app that doesn't exist
      singleSpa.unloadApplication("App that doesn't exist");
    }).toThrow()
  });
github CanopyTax / single-spa / spec / apps / happy-unload / happy-unload.spec.js View on Github external
.then(() => {
        // First caller to unloadApplication wants to waitForUnmount
        const promise1 = singleSpa.unloadApplication('./happy-unload.app.js', {waitForUnmount: true})

        // Second caller to unloadApplication doesn't want to waitForUnmount
        const promise2 = singleSpa.unloadApplication('./happy-unload.app.js', {waitForUnmount: false})

        return Promise.all([promise1, promise2])
      })
  });
github CanopyTax / single-spa / spec / apps / invalid-unload / invalid-unload.spec.js View on Github external
.then(() => {
        // The unload lifecycle hasn't been called yet, so single-spa doesn't know it is a bad impl yet.
        expect(singleSpa.getAppStatus('./invalid-unload.app.js')).toBe('MOUNTED');
        return singleSpa.unloadApplication('./invalid-unload.app.js');
      })
      .then(() => {
github CanopyTax / single-spa / spec / apps / happy-unload / happy-unload.spec.js View on Github external
.then(() => {
          expect(singleSpa.getAppStatus('./happy-unload.app.js')).toEqual('MOUNTED');
          expect(myApp.getNumBootstrapCalls()).toBe(1);
          expect(myApp.getNumMountCalls()).toBe(1);
          expect(myApp.getNumUnmountCalls()).toBe(0);
          expect(myApp.getNumUnloadCalls()).toBe(0);

          originalUnloadPromise = singleSpa
            .unloadApplication('./happy-unload.app.js', {waitForUnmount: true})
            .then(() => {
              /* This will get called only once the app is unloaded. And it will not
               * wait for the app to get remounted before it is called.
               */
              expect(singleSpa.getAppStatus('./happy-unload.app.js')).toEqual('NOT_LOADED');

              expect(myApp.getNumBootstrapCalls()).toBe(1);
              expect(myApp.getNumMountCalls()).toBe(1);
              expect(myApp.getNumUnmountCalls()).toBe(1);
              expect(myApp.getNumUnloadCalls()).toBe(1);
            })

          /* Triggering an app change after calling unloadApplication will
           * not cause the app to unload, since it is still mounted and we set
           * waitForUnmount: true.
github CanopyTax / single-spa / spec / apps / invalid-unload / invalid-unload.spec.js View on Github external
expect(() => {
      // The parameters are in the reverse order
      singleSpa.unloadApplication({waitForUnmount}, './invalid-unload.app.js');
    }).toThrow()
github CanopyTax / single-spa / spec / apps / lifecycle-props / lifecycle-props.spec.js View on Github external
      .then(() => singleSpa.unloadApplication('lifecycle-props-customProps'))
      .then(() => {
github CanopyTax / single-spa / spec / apps / lifecycle-props / lifecycle-props.spec.js View on Github external
.then(() => {
        return singleSpa.unloadApplication('lifecycle-props');
      })
      .then(() => {
github CanopyTax / single-spa / spec / apps / warning-timeouts / warning-timeouts.spec.js View on Github external
afterEach(() => {
    singleSpa.removeErrorHandler(handleError);
    return singleSpa.unloadApplication("warning-timeouts");
  });
github CanopyTax / single-spa / spec / apps / happy-unload / happy-unload.spec.js View on Github external
        .then(() => singleSpa.unloadApplication('./happy-unload.app.js'))
        .then(() => {