Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Location

The location model is also a string property with the basic textual representation of the location.

Hierarchy

Callable

  • __call(): string
  • __call(value: string, reason?: any): any
  • Reads the cached value from the property. The local cached value may differ from the corresponding value on the server.

    Returns string

  • Changes the value of the property. If the property is linked to a value on the server, this sends a requets to the server; however to track the progress of the operation, use .set(...).

    Parameters

    • value: string
    • Optional reason: any

    Returns any

Index

Properties

Methods

Properties

changed

changed: Event<function>

This event is fired whenever the property's value gets changed. The parameters are (new value, reason, old value).

get

get: Command

Fetches the actual value from the server.

reason

reason: any

The reason why the property has this value. It can be changed by the .set(...) function.

set

set: Command

Requests to change the value and returns a promise that gets resolved after the value is changed.

Methods

fork

  • Creates a property with customized .set method. The set function can be passed as a command.

    Parameters

    • set: function
        • (value: string, reason?: any): Promise<string> | string
        • Parameters

          • value: string
          • Optional reason: any

          Returns Promise<string> | string

    Returns Property<string>

map

  • Creates a property which value is derived from this property's value. The following is true at all times:

    p.map(fn)() == fn(p());

    The created property is read only and changes after the origin property.

    Type parameters

    • U

    Parameters

    • fn: function
        • (value: string): U
        • Parameters

          • value: string

          Returns U

    Returns Property<U>

once

  • once(value: string | function, fn: function): object
  • Same as adding a listener to the .changed event that removes itself once the needed event appears:

    p.changed(function listener(newValue, reason, oldValue) { if (newValue == 3) { p.changed.off(listener); ... } });

    Parameters

    • value: string | function
    • fn: function
        • (reason: any, oldValue: string): void
        • Parameters

          • reason: any
          • oldValue: string

          Returns void

    Returns object

    • dispose: function
        • (): void
        • Returns void

subscribe

  • subscribe(): object
  • Tells the property to keep its value up to date. This may result in creating a subscription on the server. If the value of the property is needed only once, it's preferrable to use .get().

    Returns object

    • dispose: function
        • (): void
        • Returns void

when

  • when(value: string | function, fn: function): object
  • Same as adding a listener to the .changed event with an if condition inside:

    p.changed((newValue, reason, oldValue) => { if (newValue == 3) { ... } });

    Parameters

    • value: string | function
    • fn: function
        • (reason: any, oldValue: string): void
        • Parameters

          • reason: any
          • oldValue: string

          Returns void

    Returns object

    • dispose: function
        • (): void
        • Returns void