UNPKG

@minofrk/xelto-diagram-canvas

Version:

An implementation of <xelto-diagram> in TypeScript.

14 lines (11 loc) 353 B
export default class PrivateMap<P extends HTMLElement, Q extends {}> { private readonly mapOfMap = new WeakMap<P, Q>(); init(that: P, initMap: Q): void { this.mapOfMap.set(that, initMap); } of(that: P): Q { const value = this.mapOfMap.get(that); if (!value) throw new TypeError(); return value; } }