Hosanna UI API v2.3.0-next
    Preparing search index...

    Screen behaviour that lives outside its view.

    The lifecycle methods are the shared vocabulary every client uses: start, suspend, resume, refresh, cancel, dispose. A view that holds a model in viewModel sends them itself; a test or a command-line host sends the same ones through perform. Do not add other names for these events.

    Declare what a view may read and send in describeContract. State is @observableFields on the subclass.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    __hs_isObservable: boolean = true
    _cacheKey: string = 'TODO'
    _hid?: string

    Identifies this object as an observer of other observables. Assigned on first use.

    contractName: string = ''

    The contract name, shared by every client's model for this screen.

    focusTarget: string = ''
    isDisposed: boolean = false
    version: number = 0

    Accessors

    • get focus(): string

      The focus target this model last asked for, or '' for none. Setting it asks the view to move focus there, every time, even to the same target. It is a view id, never a node or a coordinate.

      This is a request, not the current focus. To follow where focus is, override focused.

      Returns string

    • set focus(target: string): void

      Parameters

      • target: string

      Returns void

    Methods

    • Stop in-flight work without leaving the screen.

      Returns void

    • The screen is gone. Later results must be ignored.

      Returns void

    • The view reports that focus moved to target for a reason other than this model asking: the user navigated, or the view restored focus. A focus move this model requested through focus is not reported back.

      Parameters

      • target: string

      Returns void

    • Parameters

      • key: string

      Returns unknown

    • A key reached the view that holds this model without a focused control handling it first.

      Parameters

      • key: string

        The key, as a Key value such as 'back' or 'play'.

      • isPress: boolean

        true for the press, false for the release.

      Returns boolean

      true if this model handled the key; the view and its parents then ignore it.

    • Sends a contract action by name, as a tool or a test does.

      Parameters

      Returns boolean

      false when there is no such action.

    • Load again on request; also the retry after a failure.

      Returns void


    • Observing other observables

      @observable(['fieldA', 'fieldB']) other!: OtherObservable on an HsObservable subclass observes those fields of other, the same way the decorator does on a view. Changes arrive in onObservableFieldUpdated.


      Parameters

      • field: string
      • OptionalfieldFilters: string[]

      Returns void

    • Parameters

      • key: string
      • owner: IIdentifiable

      Returns void

    • The screen is visible again. Restart what suspend stopped.

      Parameters

      • Optionalcontext: unknown

      Returns void

    • Observes again after dispose(), using the objects currently held in the @observable fields.

      Returns void

    • Parameters

      • key: string
      • value: unknown

      Returns void

    • Assignment to an @observable field: observe the new object and notify this object's own observers.

      Parameters

      • key: string
      • value: unknown

      Returns void

    • The screen is shown for the first time. context is what only the view knows, such as layout.

      Parameters

      • Optionalcontext: unknown

      Returns void

    • The screen is no longer visible but still exists. Stop in-flight work.

      Returns void