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

Method componentWillLoad

core/src/components/router/router.tsx:63–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61 @Event() ionRouteDidChange!: EventEmitter<RouterEventDetail>;
62
63 async componentWillLoad() {
64 await waitUntilNavNode();
65
66 const canProceed = await this.runGuards(this.getSegments());
67 if (canProceed !== true) {
68 if (typeof canProceed === 'object') {
69 const { redirect } = canProceed;
70 const path = parsePath(redirect);
71 this.setSegments(path.segments, ROUTER_INTENT_NONE, path.queryString, path.fragment);
72 const result = await this.writeNavStateRoot(path.segments, ROUTER_INTENT_NONE);
73 if (result) {
74 this.maybeScrollToFragment();
75 }
76 }
77 return;
78 }
79
80 const result = await this.onRoutesChanged();
81 if (result) {
82 this.maybeScrollToFragment();
83 }
84 }
85
86 componentDidLoad() {
87 window.addEventListener('ionRouteRedirectChanged', debounce(this.onRedirectChanged.bind(this), 10));

Callers

nothing calls this directly

Calls 8

runGuardsMethod · 0.95
getSegmentsMethod · 0.95
setSegmentsMethod · 0.95
writeNavStateRootMethod · 0.95
maybeScrollToFragmentMethod · 0.95
onRoutesChangedMethod · 0.95
waitUntilNavNodeFunction · 0.90
parsePathFunction · 0.90

Tested by

no test coverage detected