An Ember Ecosystem
For Spree Commerce

spree-ember-core

Extends Ember.Mixin

Storable bolts onto an Ember Object and provides functionality for persisting key value pairs to Local Storage.

Methods

Show Private Methods

_fetchLocalStorageData

private

Returns a Parsed Object from the Local Storage Key.


Returns:

Object:

An object of Key Value pairs from local storage.

_setOnHost

(
  • data
)
private

Sets key value pairs on the Host object.

Parameters:

  • data Object

    A Javascript Object to set on the Ember Object.


Returns:

Boolean:

Will always resolve to true.

persist

(
  • data
)

Persists an object to Local Storage. Will overwrite existing values, and can be used to nullify an existing value.

this.spree.persist({
  "favoriteColor": "red"
});

Parameters:

  • data Object

    A Javascript Object to persist to Local Storage.


Returns:

Boolean:

Will always resolve to true.

restore

Sets key value pairs on the Host object from Local Storage. Usually called in intitalizers for Spree Ember addons.

this.spree.restore()

Returns:

Boolean:

Will always resolve to true.

Properties

Show Private Properties

localStorageKey

String

The Local Storage key we use to Restore and Persist data across browser refreshes.


Default: 'storable'