Options
All
  • Public
  • Public/Protected
  • All
Menu

A persistent plain object or array.

See also PersistoOptions.

Hierarchy

  • PersistentObject

Index

Constructors

constructor

Properties

commitCount

commitCount: number = 0

Readonly namespace

namespace: string

pushCount

pushCount: number = 0

ready

ready: Promise<any>

version

version: string = "@VERSION"

Methods

commit

  • commit(): string
  • Write modified data to localStorage.

    (Normally there is no need to call this method, since it is triggered internally after a short collation interval.)

    Returns string

debug

  • debug(...args: any[]): void

get

  • get(key: string): any
  • Return a data property value (key supports dot notation).

    Parameters

    • key: string

    Returns any

isDirty

  • isDirty(): boolean
  • Return true if there are uncommited or unpushed modifications.

    Returns boolean

isReady

  • isReady(): void
  • Return true if initial pull has completed.

    See also the store.ready promise, that is resolved accordingly.

    Returns void

log

  • log(...args: any[]): void

pull

  • pull(): Promise<void>
  • Download data from the cloud, then call .update().

    Returns Promise<void>

push

  • push(): Promise<void>
  • Commit, then upload data into the cloud.

    (Normally there is no need to call this method, since it is triggered internally.)

    Returns Promise<void>

readFromForm

  • readFromForm(form?: any, options?: any): void
  • Read data properties from form input elements with the same name.

    Supports elements of input (type: text, radio, checkbox), textarea, and select.
    form* may be a form element or selector string. Example: "#myForm".
    (defaults to PersistoOptions.attachForm)
    options* is optional and defaults to {addNew: false, coerce: true, trim: true}.

    Parameters

    • Optional form: any
    • Optional options: any

    Returns void

remove

  • remove(key: string): void
  • Delete object property and set the dirty flag (key supports dot notation).

    Parameters

    • key: string

    Returns void

reset

  • reset(newData?: any): void
  • Replace data object with a new instance and set the dirty flag.

    Parameters

    • Optional newData: any

      is optional and defaults to {}

    Returns void

set

  • set(key: string, value: any): void
  • Modify object property and set the dirty flag (key supports dot notation).

    value* must be convertible to JSON.

    Parameters

    • key: string
    • value: any

    Returns void

setDirty

  • setDirty(flag?: boolean): void
  • Flag object as modified, so that commit / push will be scheduled.

    Parameters

    • Optional flag: boolean

    Returns void

toString

  • toString(): string
  • Return readable string representation for this instance.

    internal

    Returns string

update

  • update(): void

writeToForm

  • writeToForm(form?: any, options?: any): void
  • Write data to form elements with the same name.

    form may be a form selector or HTMLElement object. Example: "#myForm" (defaults to PersistoOptions.attachForm)

    Parameters

    • Optional form: any
    • Optional options: any

    Returns void

Generated using TypeDoc