node_modules/@analytics/core/lib/analytics.es.js
/*
   * Adds a change listener. It will be called any time an action is dispatched,
   * and some part of the state tree may potentially have changed. You may then
   * call `getState()` to read the current state tree inside the callback.
   *
   * You may call `dispatch()` from a change listener, with the following
   * caveats:
   *
   * 1. The subscriptions are snapshotted just before every `dispatch()` call.
   * If you subscribe or unsubscribe while the listeners are being invoked, this
   * will not have any effect on the `dispatch()` that is currently in progress.
   * However, the next `dispatch()` call, whether nested or not, will use a more
   * recent snapshot of the subscription list.
   *
   * 2. The listener should not expect to see all state changes, as the state
   * might have been updated multiple times during a nested `dispatch()` before
   * the listener is called. It is, however, guaranteed that all subscribers
   * registered before the `dispatch()` started will be called with the latest
   * state by the time it exits.
   *
   * @param {Function} listener A callback to be invoked on every dispatch.
   * @returns {Function} A function to remove this change listener.
   */
Adds a change listener. It will be called any time an action is dispatched,
and some part of the state tree may potentially have changed. You may then
call `getState()` to read the current state tree inside the callback.

You may call `dispatch()` from a change listener, with the following
caveats.

1. The subscriptions are snapshotted just before every `dispatch()` call.
If you subscribe or unsubscribe while the listeners are being invoked, this
will not have any effect on the `dispatch()` that is currently in progress.
However, the next `dispatch()` call, whether nested or not, will use a more
recent snapshot of the subscription list.

2. The listener should not expect to see all state changes, as the state
might have been updated multiple times during a nested `dispatch()` before
the listener is called. It is, however, guaranteed that all subscribers
registered before the `dispatch()` started will be called with the latest
state by the time it exits.

@param {Function} listener A callback to be invoked on every dispatch.
@returns {Function} A function to remove this change listener.
Adds a change listener . It will be called any time an action is dispatched and some part of the state tree may potentially have changed . You may then call ` getState () ` to read the current state tree inside the callback . You may call ` dispatch () ` from a change listener with the following caveats . 1 . The subscriptions are snapshotted just before every ` dispatch () ` call . If you subscribe or unsubscribe while the listeners are being invoked this will not have any effect on the ` dispatch () ` that is currently in progress . However the next ` dispatch () ` call whether nested or not will use a more recent snapshot of the subscription list . 2 . The listener should not expect to see all state changes as the state might have been updated multiple times during a nested ` dispatch () ` before the listener is called . It is however guaranteed that all subscribers registered before the ` dispatch () ` started will be called with the latest state by the time it exits . @param { Function } listener A callback to be invoked on every dispatch . @returns { Function } A function to remove this change listener .
function subscribe(listener) {
    if (_typeof_1(listener) !== FUNC) {
      throw new Error('Listener' + msg);
    }
    var isSubscribed = true;
    ensureCanMutateNextListeners();
    nextListeners.push(listener);
    return function unsubscribe() {
      if (!isSubscribed) {
        return;
      }
      isSubscribed = false;
      ensureCanMutateNextListeners();
      var index = nextListeners.indexOf(listener);
      nextListeners.splice(index, 1);
    };
  }
function subscribe ( listener ) { if ( _typeof_1 ( listener ) !== FUNC ) { throw new Error ( 'Listener' + msg ) ; } var isSubscribed = true ; ensureCanMutateNextListeners ( ) ; nextListeners . push ( listener ) ; return function unsubscribe ( ) { if ( ! isSubscribed ) { return ; } isSubscribed = false ; ensureCanMutateNextListeners ( ) ; var index = nextListeners . indexOf ( listener ) ; nextListeners . splice ( index , 1 ) ; } ; }
Adds a change listener.
Adds a change listener .