UNPKG

@helia/verified-fetch

Version:

A fetch-like API for obtaining verified & trustless IPFS content on the web

25 lines 881 B
/** * Base class for verified-fetch plugins. This class provides a basic implementation of the `FetchHandlerPlugin` * interface. * * Subclasses must implement the `id` property and the `canHandle` and `handle` methods. * Subclasses may override the `codes` and `log` properties. * * If your plugin adds/edits the context supplied in `handle`, you should increment the `context.modified` property. */ export class BasePlugin { codes = []; pluginOptions; _log; get log() { // instantiate the logger lazily because it depends on the id, which is not set until after the constructor is called if (this._log == null) { this._log = this.pluginOptions.logger.forComponent(this.id); } return this._log; } constructor(options) { this.pluginOptions = options; } } //# sourceMappingURL=plugin-base.js.map