ngx-warehouse
Options
All
  • Public
  • Public/Protected
  • All
Menu

The primary storage service. This is a wrapper around localForage. The endpoints provided by localForage are converted to observables.

export
class

Warehouse

Hierarchy

  • Warehouse

Index

Constructors

Methods

Constructors

constructor

Methods

count

  • count(): Observable<number>

destroy

  • destroy(): Observable<boolean | Error>
  • USE WITH CAUTION: Removes every key from the database, returning it to a blank slate.

    memberof

    Warehouse

    Returns Observable<boolean | Error>

get

  • get(key: string): Observable<any>
  • Gets an item from the storage library and supplies the result to a callback. If the key does not exist, getItem() will return null.

    Even if undefined is saved, null will be returned by getItem(). This is due to a limitation in localStorage, and for compatibility reasons localForage cannot store the value undefined.

    Warehouse.get('key').subscribe( (item) => { // do something with item }, (error) => { // handle the error } );

    memberof

    Warehouse

    Parameters

    • key: string

    Returns Observable<any>

key

  • key(index: number): Observable<string>
  • Get the name of a key based on its ID.

    This method is inherited from the localStorage API, but is acknowledged to be kinda weird.

    memberof

    Warehouse

    Parameters

    • index: number

    Returns Observable<string>

keys

  • keys(): Observable<string[]>

remove

  • remove(key: string): Observable<any>

set

  • set(key: string, value: any): Observable<any>
  • Saves data to the offline store. You can store the following types of JavaScript objects:

    • Array
    • ArrayBuffer
    • Blob
    • Float32Array
    • Float64Array
    • Int8Array
    • Int16Array
    • Int32Array
    • Number
    • Object
    • Uint8Array
    • Uint8ClampedArray
    • Uint16Array
    • Uint32Array
    • String

    When using localStorage and WebSQL backends, binary data will be serialized before being saved (and retrieved). This serialization will incur a size increase when binary data is saved.

    Warehouse.set('key', value).subscribe( (item) => { // do something with newly saved item }, (error) => { // handle the error } );

    memberof

    Warehouse

    Parameters

    • key: string
    • value: any

    Returns Observable<any>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc