confirmationservice.js 1.6 KB

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  3. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  5. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  6. return c > 3 && r && Object.defineProperty(target, key, r), r;
  7. };
  8. Object.defineProperty(exports, "__esModule", { value: true });
  9. var core_1 = require("@angular/core");
  10. var rxjs_1 = require("rxjs");
  11. var ConfirmationService = /** @class */ (function () {
  12. function ConfirmationService() {
  13. this.requireConfirmationSource = new rxjs_1.Subject();
  14. this.acceptConfirmationSource = new rxjs_1.Subject();
  15. this.requireConfirmation$ = this.requireConfirmationSource.asObservable();
  16. this.accept = this.acceptConfirmationSource.asObservable();
  17. }
  18. ConfirmationService.prototype.confirm = function (confirmation) {
  19. this.requireConfirmationSource.next(confirmation);
  20. return this;
  21. };
  22. ConfirmationService.prototype.onAccept = function () {
  23. this.acceptConfirmationSource.next();
  24. };
  25. ConfirmationService = __decorate([
  26. core_1.Injectable()
  27. ], ConfirmationService);
  28. return ConfirmationService;
  29. }());
  30. exports.ConfirmationService = ConfirmationService;
  31. //# sourceMappingURL=confirmationservice.js.map