diffusion
Version:
Diffusion JavaScript client
77 lines (76 loc) • 2.2 kB
JavaScript
;
/**
* @module TopicUpdate
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateStreamImpl = void 0;
/**
* Implementation of the {@link InternalUpdateStream}
*
* This implementation holds a delegate that can be exchanged depending on the
* state of the stream
*/
var UpdateStreamImpl = /** @class */ (function () {
/**
* Create a new UpdateStreamImpl instance
*
* @param internalStreamFactory the factory function that creates the
* initial delegate
*/
function UpdateStreamImpl(internalStreamFactory) {
this.delegate = internalStreamFactory(this);
}
/**
* @inheritdoc
*/
UpdateStreamImpl.prototype.set = function (value) {
return this.delegate.set(value);
};
/**
* @inheritdoc
*/
UpdateStreamImpl.prototype.get = function () {
return this.delegate.get();
};
/**
* @inheritdoc
*/
UpdateStreamImpl.prototype.validate = function () {
return this.delegate.validate();
};
/**
* @inheritdoc
*/
UpdateStreamImpl.prototype.onSetComplete = function (streamId, retainsValue, supportsConflation) {
this.delegate.onSetComplete(streamId, retainsValue, supportsConflation);
};
/**
* @inheritdoc
*/
UpdateStreamImpl.prototype.onSetFailed = function (err) {
this.delegate.onSetFailed(err);
};
/**
* @inheritdoc
*/
UpdateStreamImpl.prototype.onValidateComplete = function (streamId, retainsValue, supportsConflation) {
this.delegate.onValidateComplete(streamId, retainsValue, supportsConflation);
};
/**
* @inheritdoc
*/
UpdateStreamImpl.prototype.onValidateFailed = function (err) {
this.delegate.onValidateFailed(err);
};
/**
* Set the delegate stream
*
* This is usually called by the current delegate in response of a change of
* the internal state.
*/
UpdateStreamImpl.prototype.setDelegate = function (newDelegate) {
this.delegate = newDelegate;
};
return UpdateStreamImpl;
}());
exports.UpdateStreamImpl = UpdateStreamImpl;