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

Function writeSegments

core/src/components/router/utils/path.ts:25–41  ·  view source on GitHub ↗
(
  history: History,
  root: string,
  useHash: boolean,
  segments: string[],
  direction: RouterDirection,
  state: number,
  queryString?: string,
  fragment?: string
)

Source from the content-addressed store, hash-verified

23};
24
25export const writeSegments = (
26 history: History,
27 root: string,
28 useHash: boolean,
29 segments: string[],
30 direction: RouterDirection,
31 state: number,
32 queryString?: string,
33 fragment?: string
34) => {
35 const url = generateUrl([...parsePath(root).segments, ...segments], useHash, queryString, fragment);
36 if (direction === ROUTER_INTENT_FORWARD) {
37 history.pushState(state, '', url);
38 } else {
39 history.replaceState(state, '', url);
40 }
41};
42
43/**
44 * Transforms a chain to a list of segments.

Callers 2

setSegmentsMethod · 0.90
path.spec.tsxFile · 0.90

Calls 2

generateUrlFunction · 0.85
parsePathFunction · 0.85

Tested by

no test coverage detected