"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Event = void 0;
var rxjs_1 = require("rxjs");
var Event = (function () {
    function Event(initial, imutable) {
        if (imutable === void 0) { imutable = false; }
        this.snapshot = undefined;
        this.imutable = false;
        this.imutable = imutable;
        this.source = new rxjs_1.ReplaySubject(1);
        this.snapshot = initial;
        this.observable = this.source.asObservable();
        if (initial) {
            this.source.next(initial);
        }
    }
    Event.prototype.set = function (data) {
        if (this.imutable) {
            if (this.snapshot !== data) {
                this.snapshot = data;
                this.source.next(data);
            }
        }
        else {
            this.snapshot = data;
            this.source.next(data);
        }
    };
    return Event;
}());
exports.Event = Event;
//# sourceMappingURL=event.service.js.map