Sha256: f9a59bf292aac776ab0032f04839c3bd0be5739cb86504bbb27f68886b485667
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
import { combine, DirtyableTag } from '@glimmer/reference'; /** * Represents the root outlet. */ export class RootOutletReference { constructor(outletState) { this.outletState = outletState; this.tag = DirtyableTag.create(); } get(key) { return new PathReference(this, key); } value() { return this.outletState; } update(state) { this.outletState.outlets.main = state; this.tag.inner.dirty(); } } /** * Represents the connected outlet. */ export class OutletReference { constructor(parentStateRef, outletNameRef) { this.parentStateRef = parentStateRef; this.outletNameRef = outletNameRef; this.tag = combine([parentStateRef.tag, outletNameRef.tag]); } value() { let outletState = this.parentStateRef.value(); let outlets = outletState === undefined ? undefined : outletState.outlets; return outlets === undefined ? undefined : outlets[this.outletNameRef.value()]; } get(key) { return new PathReference(this, key); } } /** * Outlet state is dirtied from root. * This just using the parent tag for dirtiness. */ class PathReference { constructor(parent, key) { this.parent = parent; this.key = key; this.tag = parent.tag; } get(key) { return new PathReference(this, key); } value() { let parent = this.parent.value(); return parent && parent[this.key]; } }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.6.0.0 | dist/es/@ember/-internals/glimmer/lib/utils/outlet.js |