'use strict';

var Defer = (function () {

  function Promise() {}

  Promise.prototype = {

    then: function (resolve) {
      this.resolve = resolve;
    },

    otherwise: function (reject) {
      this.reject = reject;
    }
  };

  function _defer() {
    /* jshint validthis: true */
    this.promise = new Promise();
  }

  _defer.prototype = {

    resolve: function (response) {
      this.promise.resolve(response);
    },

    reject: function () {
      this.promise.reject();
    }
  };

  return _defer;
}());
