import { Injectable } from '@angular/core'; @Injectable({ providedIn: 'root' }) export class FarrisComponentInstanceService { private _state = new WeakMap(); constructor() {} add(key: any, value: any) { this._state.set(key, value); } get(key: any) { return this._state.get(key); } destroy(key: any) { this._state.set(key, null); this._state.delete(key); } }