MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / queueTrns

Method queueTrns

core/src/components/nav/nav.tsx:516–560  ·  view source on GitHub ↗

* Adds a navigation stack change to the queue and schedules it to run. * * @returns Whether the transition succeeds.

(ti: TransitionInstruction, done: TransitionDoneFn | undefined)

Source from the content-addressed store, hash-verified

514 * @returns Whether the transition succeeds.
515 */
516 private async queueTrns(ti: TransitionInstruction, done: TransitionDoneFn | undefined): Promise<boolean> {
517 if (this.isTransitioning && ti.opts?.skipIfBusy) {
518 return false;
519 }
520
521 const promise = new Promise<boolean>((resolve, reject) => {
522 ti.resolve = resolve;
523 ti.reject = reject;
524 });
525 ti.done = done;
526
527 /**
528 * If using router, check to see if navigation hooks
529 * will allow us to perform this transition. This
530 * is required in order for hooks to work with
531 * the ion-back-button or swipe to go back.
532 */
533 if (ti.opts && ti.opts.updateURL !== false && this.useRouter) {
534 const router = document.querySelector('ion-router');
535 if (router) {
536 const canTransition = await router.canTransition();
537 if (canTransition === false) {
538 return false;
539 }
540 if (typeof canTransition === 'string') {
541 router.push(canTransition, ti.opts!.direction || 'back');
542 return false;
543 }
544 }
545 }
546
547 // Normalize empty
548 if (ti.insertViews?.length === 0) {
549 ti.insertViews = undefined;
550 }
551
552 // Enqueue transition instruction
553 this.transInstr.push(ti);
554
555 // if there isn't a transition already happening
556 // then this will kick off this transition
557 this.nextTrns();
558
559 return promise;
560 }
561
562 private success(result: NavResult, ti: TransitionInstruction) {
563 if (this.destroyed) {

Callers 4

insertPagesMethod · 0.95
popToMethod · 0.95
removeIndexMethod · 0.95
setPagesMethod · 0.95

Calls 3

nextTrnsMethod · 0.95
canTransitionMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected