node_modules/pinia/dist/pinia.iife.js
/**
       * Wraps an action to handle subscriptions.
       *
       * @param name - name of the action
       * @param action - action to wrap
       * @returns a wrapped action to handle subscriptions
       */
Wraps an action to handle subscriptions.
@param name - name of the action
@param action - action to wrap
@returns a wrapped action to handle subscriptions
Wraps an action to handle subscriptions . @param name - name of the action @param action - action to wrap @returns a wrapped action to handle subscriptions
function wrapAction(name, action) {
          return function () {
              setActivePinia(pinia);
              const args = Array.from(arguments);
              const afterCallbackList = [];
              const onErrorCallbackList = [];
              function after(callback) {
                  afterCallbackList.push(callback);
              }
              function onError(callback) {
                  onErrorCallbackList.push(callback);
              }
              triggerSubscriptions(actionSubscriptions, {
                  args,
                  name,
                  store,
                  after,
                  onError,
              });
              let ret;
              try {
                  ret = action.apply(this && this.$id === $id ? this : store, args);
              }
              catch (error) {
                  triggerSubscriptions(onErrorCallbackList, error);
                  throw error;
              }
              if (ret instanceof Promise) {
                  return ret
                      .then((value) => {
                      triggerSubscriptions(afterCallbackList, value);
                      return value;
                  })
                      .catch((error) => {
                      triggerSubscriptions(onErrorCallbackList, error);
                      return Promise.reject(error);
                  });
              }
              triggerSubscriptions(afterCallbackList, ret);
              return ret;
          };
      }
function wrapAction ( name , action ) { return function ( ) { setActivePinia ( pinia ) ; const args = Array . from ( arguments ) ; const afterCallbackList = [ ] ; const onErrorCallbackList = [ ] ; function after ( callback ) { afterCallbackList . push ( callback ) ; } function onError ( callback ) { onErrorCallbackList . push ( callback ) ; } triggerSubscriptions ( actionSubscriptions , { args , name , store , after , onError , } ) ; let ret ; try { ret = action . apply ( this && this . $id === $id ? this : store , args ) ; } catch ( error ) { triggerSubscriptions ( onErrorCallbackList , error ) ; throw error ; } if ( ret instanceof Promise ) { return ret . then ( ( value ) => { triggerSubscriptions ( afterCallbackList , value ) ; return value ; } ) . catch ( ( error ) => { triggerSubscriptions ( onErrorCallbackList , error ) ; return Promise . reject ( error ) ; } ) ; } triggerSubscriptions ( afterCallbackList , ret ) ; return ret ; } ; }
Wraps an action to handle subscriptions.
Wraps an action to handle subscriptions .
// @ts-expect-error // handle sync errors // allow the afterCallback to override the return value