UNPKG

lazy-widgets

Version:

Typescript retained mode GUI for the HTML canvas API

36 lines 953 B
import { Parent } from './Parent.js'; /** * A specialised version of the {@link Parent} class for parents with a single * mandatory child. * * @category Widget */ export class SingleParent extends Parent { /** * @param child - The mandatory single child of this widget. Cannot be changed later. */ constructor(child, properties) { super(properties); this.child = child; child.inheritedTheme = this.inheritedTheme; } [Symbol.iterator]() { const child = this.child; let first = true; return { next() { if (first) { first = false; return { value: child, done: false }; } else { return { value: undefined, done: true }; } } }; } get childCount() { return 1; } } //# sourceMappingURL=SingleParent.js.map