aws / aws-sdk-mobile-analytics-js

Amazon Mobile Analytics JavaScript SDK
Apache License 2.0
82 stars 38 forks source link

Allow for configurable local storage #3

Open summraznboi opened 9 years ago

summraznboi commented 9 years ago

Currently LocalStorage.js uses a very browser-based storage, but in environments such as Appcelerator, local storage is implemented entirely differently (using thin wrappers to native mobile persistence APIs such as iOS Core Data and Android Shared Preferences). Ideally there can be a way for the user to pass in their own local storage implementation (similar to AMA.Client.Logger in AMA.Client.Options).

cheruvian commented 9 years ago

The currently supported method for implementing a custom Storage/Persistence client for the Amazon Mobile Analytics SDK for JavaScript is to override the AMA.Storage object.

Be sure to implement the get, set, delete, each, and setLogger functions.

AMA.Storage = {
    get: AMA.Util.NOP,
    set: AMA.Util.NOP
    delete: AMA.Util.NOP
    each: AMA.Util.NOP
    setLogger: AMA.Util.NOP
};

If you have a Storage Client you would like to contribute, feel free to send us a Pull Request and we will assess pulling it in.

Thanks, Ryan