MCPcopy Create free account
hub / github.com/ionic-team/ionic-framework / getDelegate

Method getDelegate

core/src/components/modal/modal.tsx:555–577  ·  view source on GitHub ↗

* Determines whether or not an overlay * is being used inline or via a controller/JS * and returns the correct delegate. * By default, subsequent calls to getDelegate * will use a cached version of the delegate. * This is useful for calling dismiss after * present so that the corre

(force = false)

Source from the content-addressed store, hash-verified

553 * present so that the correct delegate is given.
554 */
555 private getDelegate(force = false) {
556 if (this.workingDelegate && !force) {
557 return {
558 delegate: this.workingDelegate,
559 inline: this.inline,
560 };
561 }
562
563 /**
564 * If using overlay inline
565 * we potentially need to use the coreDelegate
566 * so that this works in vanilla JS apps.
567 * If a developer has presented this component
568 * via a controller, then we can assume
569 * the component is already in the
570 * correct place.
571 */
572 const parentEl = this.el.parentNode as HTMLElement | null;
573 const inline = (this.inline = parentEl !== null && !this.hasController);
574 const delegate = (this.workingDelegate = inline ? this.delegate || this.coreDelegate : this.delegate);
575
576 return { inline, delegate };
577 }
578
579 /**
580 * Determines whether or not the

Callers 2

presentMethod · 0.95
dismissMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected