src/directive.js
function extendApi(api) {
      api.$on = (eventName, callback) => {
        const wrappedCallback = () => {
          $timeout(() => {
            callback(api.get());
          });
        };

        api.on(eventName, wrappedCallback);

        return () => {
          api.off(eventName, wrappedCallback);
        };
      };

      return api;
    }
function extendApi(api) {
      api.$on = (eventName, callback) => {
        const wrappedCallback = () => {
          $timeout(() => {
            callback(api.get());
          });
        };

        api.on(eventName, wrappedCallback);

        return () => {
          api.off(eventName, wrappedCallback);
        };
      };

      return api;
    }
Extends the API returned by noUiSlider with the `$on` function which wraps the `on` function
to use Angular.

@param {Object} api The API instance returned by the `noUiSlider.create()` method
@return {Object} The API instance with the added `$on` function