UNPKG

@helia/verified-fetch

Version:

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

25 lines 757 B
/** * Base class for verified-fetch plugins. This class provides a basic * implementation of the `VerifiedFetchPlugin` interface. * * Subclasses must implement the `id` property, the `canHandle`, and `handle` * methods. * * Subclasses may override the `codes` and `log` properties. */ export class BasePlugin { 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.newScope(this.id); } return this._log; } constructor(options) { this.pluginOptions = options; } } //# sourceMappingURL=plugin-base.js.map