Options
All
  • Public
  • Public/Protected
  • All
Menu

This is the internal core of the hash fragment/deeplink functionality. You probably want the browser-enabled UrlFragment instance exported from url-fragment.

Hierarchy

Index

Constructors

constructor

  • Parameters

    • hashSetter: (s: string) => void

      A function which will be called when the UrlFragmentCore wants to set the hash in the browser.

        • (s: string): void
        • Parameters

          • s: string

          Returns void

    Returns UrlFragmentCore

Methods

parse

  • parse(hashFragment: string): void
  • To be called when the hash fragment in the browser URL changes. (This is automatically set up in UrlFragment)

    Parameters

    • hashFragment: string

    Returns void

set

  • set(key: string, value: undefined | string | number | (string | number)[]): UrlFragmentCore
  • Setting a value in the hash fragment does not emit a corresponding value in the Observable from the {@link UrlFragment#watch} methods. This is deliberate, to prevent accidental feedback loops, and to avoid that the hash fragment is used as a component-to-component communications channel. It is best to think of the URL fragment as a storage which a service/component can use to store and re-establish its own state, not as a messaging system to other components. As a (very strong) rule of thumb, a component should not set anything that it doesn't itself watch.

    Parameters

    • key: string
    • value: undefined | string | number | (string | number)[]

    Returns UrlFragmentCore

watch

  • watch(key: string): Observable<undefined | string>
  • Returns an observable which will emit when the given key changes in the URL hash fragment.

    Parameters

    • key: string

    Returns Observable<undefined | string>

watchArray

  • watchArray(key: string): Observable<undefined | string[]>
  • Parameters

    • key: string

    Returns Observable<undefined | string[]>

watchNumber

  • watchNumber(key: string): Observable<undefined | number>
  • Parameters

    • key: string

    Returns Observable<undefined | number>

watchNumberArray

  • watchNumberArray(key: string): Observable<undefined | number[]>
  • Parameters

    • key: string

    Returns Observable<undefined | number[]>