MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / setCurrent

Method setCurrent

packages/core/ui/frame/frame-common.ts:258–290  ·  view source on GitHub ↗
(entry: BackstackEntry, navigationType: NavigationType)

Source from the content-addressed store, hash-verified

256 }
257
258 public setCurrent(entry: BackstackEntry, navigationType: NavigationType): void {
259 const fromEntry = this._currentEntry;
260 const newPage = entry.resolvedPage;
261
262 // In case we navigated forward to a page that was in the backstack
263 // with clearHistory: true
264 if (!newPage.frame) {
265 this._resolvedPage = newPage;
266
267 this._addView(newPage);
268 }
269
270 this._currentEntry = entry;
271
272 const isBack = navigationType === NavigationType.back;
273 if (isBack) {
274 this._pushInFrameStack();
275 }
276
277 newPage.onNavigatedTo(isBack);
278 this.notify<NavigationData>({
279 eventName: FrameBase.navigatedToEvent,
280 object: this,
281 isBack,
282 entry,
283 fromEntry,
284 });
285
286 // Reset executing context after NavigatedTo is raised;
287 // we do not want to execute two navigations in parallel in case
288 // additional navigation is triggered from the NavigatedTo handler.
289 this._executingContext = null;
290 }
291
292 public _updateBackstack(entry: BackstackEntry, navigationType: NavigationType): void {
293 const isBack = navigationType === NavigationType.back;

Callers

nothing calls this directly

Calls 3

_pushInFrameStackMethod · 0.95
onNavigatedToMethod · 0.80
notifyMethod · 0.65

Tested by

no test coverage detected