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

Method push

core/src/components/router/router.tsx:143–169  ·  view source on GitHub ↗
(path: string, direction: RouterDirection = 'forward', animation?: AnimationBuilder)

Source from the content-addressed store, hash-verified

141 */
142 @Method()
143 async push(path: string, direction: RouterDirection = 'forward', animation?: AnimationBuilder) {
144 if (path.startsWith('.')) {
145 const currentPath = this.previousPath ?? '/';
146 // Convert currentPath to an URL by pre-pending a protocol and a host to resolve the relative path.
147 const url = new URL(path, `https://host/${currentPath}`);
148 path = url.pathname + url.search + url.hash;
149 }
150
151 let parsedPath = parsePath(path);
152
153 const canProceed = await this.runGuards(parsedPath.segments);
154 if (canProceed !== true) {
155 if (typeof canProceed === 'object') {
156 parsedPath = parsePath(canProceed.redirect);
157 } else {
158 return false;
159 }
160 }
161
162 this.setSegments(parsedPath.segments, direction, parsedPath.queryString, parsedPath.fragment);
163 const result = await this.writeNavStateRoot(parsedPath.segments, direction, animation);
164 if (result) {
165 this.maybeScrollToFragment();
166 }
167
168 return result;
169 }
170
171 /** Go back to previous page in the window.history. */
172 @Method()

Callers 13

onStartMethod · 0.45
renderRangeSliderMethod · 0.45
radio.e2e.tsFile · 0.45
refresher.e2e.tsFile · 0.45
flattenNodeFunction · 0.45
chainToSegmentsFunction · 0.45
printRoutesFunction · 0.45
readNavStateFunction · 0.45
router.e2e.tsFile · 0.45
radio-group.e2e.tsFile · 0.45

Calls 5

runGuardsMethod · 0.95
setSegmentsMethod · 0.95
writeNavStateRootMethod · 0.95
maybeScrollToFragmentMethod · 0.95
parsePathFunction · 0.90

Tested by

no test coverage detected