addThingToDo()

in packages/vue/vue-application/src/Application.js [150:171]


    addThingToDo(action, thing = () => {}) {
      if (this.hasError && action !== 'unmount') {
        return;
      }
      
      this.nextThingToDo = (this.nextThingToDo || Promise.resolve())
        .then((...args) => {
          if (this.unmounted && action !== 'unmount') {
            return;
          }
          return thing(...args);
        })
        .catch((err) => {
          this.nextThingToDo = Promise.resolve();
          const error = new Error(`During '${action}', os application threw an error: ${err.message}`)
          this.hasError = true;
          this.subLoading = false;
          this.error = error;
          this.$emit('appDidCatch', error);
          console.error(error);
        })
    }