UNPKG

diffusion

Version:

Diffusion JavaScript client

73 lines (72 loc) 2.85 kB
"use strict"; /** * @module Routing */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.NoValueEntry = void 0; var topic_cache_entry_1 = require("./../routing/topic-cache-entry"); /** * Implementation of {@link TopicCacheEntry} that doesn't cache a value */ var NoValueEntry = /** @class */ (function (_super) { __extends(NoValueEntry, _super); /** * Create a new NoValueEntry instance * * @param streams the stream adapters * @param path the topic path * @param specification the topic specification */ function NoValueEntry(streams, path, specification) { return _super.call(this, streams, path, specification) || this; } /** * Handle a value * * Notifies the streams with the raw CBOR data. No old value is passed on. * * @param oldContent the buffer containing the old content * @param received the content as a Uint8Array * @param registry the stream registry * @param errorHandler an error handler that will be called if an error occurs */ NoValueEntry.prototype.handleValue = function (received, registry) { this.notifyValue(null, received, null, received, registry); }; /** * Handle a value * * Notifies the streams with the raw CBOR data containing the delta. No new * or old values are passed on. * * @param received the content as a Uint8Array * @param registry the stream registry * @param errorHandler an error handler that will be called with an {@link InvalidDataError} if an error occurs */ NoValueEntry.prototype.handleDelta = function (received, registry) { this.notifyDelta(null, received, null, null, received, registry); }; /** * Does not notify the streams because we don't have a cached value */ NoValueEntry.prototype.notifyValueToNewStream = function () { // no value }; return NoValueEntry; }(topic_cache_entry_1.TopicCacheEntry)); exports.NoValueEntry = NoValueEntry;