UNPKG

@etherspot/prime-sdk

Version:

Etherspot Prime (Account Abstraction) SDK

26 lines (25 loc) 667 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Context = void 0; const common_1 = require("./common"); class Context { constructor(services) { this.services = services; this.error$ = new common_1.ErrorSubject(); this.attached = []; const items = [...Object.values(services)]; for (const item of items) { this.attach(item); } } attach(service) { this.attached.push(service); service.init(this); } destroy() { for (const attached of this.attached) { attached.destroy(); } } } exports.Context = Context;