src/plugins/debounced.js
function buildAsyncSaveFun(_this, _oldSave, _promise, _oldPromise) {
    return function() {

      // swap promises so save behaves like it has been called during the original call.
      var currentPromise = _this.$promise;
      _this.$promise = _oldPromise;

      // when save resolves, the timeout promise is resolved and the last resource promise returned
      // so it behaves
      _oldSave.call(_this).$promise.then(
        function(_data) {
          _promise.resolve(_data);
          _this.$promise = currentPromise;
        }, function(_reason) {
          _promise.reject(_reason);
          _this.$promise = currentPromise;
        }
      );

      _this.$dmStatus = null;
    };
  }
function buildAsyncSaveFun(_this, _oldSave, _promise, _oldPromise) {
    return function() {

      // swap promises so save behaves like it has been called during the original call.
      var currentPromise = _this.$promise;
      _this.$promise = _oldPromise;

      // when save resolves, the timeout promise is resolved and the last resource promise returned
      // so it behaves
      _oldSave.call(_this).$promise.then(
        function(_data) {
          _promise.resolve(_data);
          _this.$promise = currentPromise;
        }, function(_reason) {
          _promise.reject(_reason);
          _this.$promise = currentPromise;
        }
      );

      _this.$dmStatus = null;
    };
  }
function buildAsyncSaveFun ( _this , _oldSave , _promise , _oldPromise ) { return function ( ) { // swap promises so save behaves like it has been called during the original call. var currentPromise = _this . $promise ; _this . $promise = _oldPromise ; // when save resolves, the timeout promise is resolved and the last resource promise returned // so it behaves _oldSave . call ( _this ) . $promise . then ( function ( _data ) { _promise . resolve ( _data ) ; _this . $promise = currentPromise ; } , function ( _reason ) { _promise . reject ( _reason ) ; _this . $promise = currentPromise ; } ) ; _this . $dmStatus = null ; } ; }
builds a new async save function bound to a given context and promise.
builds a new async save function bound to a given context and promise .