kano-shared-storage-client

1.0.0 • Public • Published

Kano Shared Storage Client

Library script to define a class for instantiating an instance of zendesk's shared storage client.

The client is placed on the Kano.World.SharedStorage property.

The constructor of the KanoSharedStorageClient accepts an options dictionary with the following keys:

  • keyMap: dictonary of keys mapping app objects to their local storage keys. Currently accepts key definitions for progress, session and token. Defaults to
{
  progress:               "KW_PROGRESS",
  progressEvents:         "KW_PROGESS_EVENTS",
  session:                "KW_SESSION",
  token:                  "KW_TOKEN",
  localGamificationState: "KW_LOCAL_GAMIFICATION_STATE"
}
  • sharedStorageURL: Url to cross-storage hub instance

For example

const options = {
  keyMap: {progress: "progress"},
  sharedStorageURL: Config.SHARED_STORAGE_URL
}
const SharedStorage = new Kano.KanoSharedStorageClient(options);

API

KanoSharedStorageClient.getToken
KanoSharedStorageClient.setToken
KanoSharedStorageClient.deleteToken
KanoSharedStorageClient.getProgress
KanoSharedStorageClient.setProgress
KanoSharedStorageClient.deleteProgress
KanoSharedStorageClient.saveProgressEvent
KanoSharedStorageClient.getProgressEvents
KanoSharedStorageClient.deleteProgressEvents
KanoSharedStorageClient.saveLocalGamificationState
KanoSharedStorageClient.getLocalGamificationState
KanoSharedStorageClient.deleteLocalGamificationState
KanoSharedStorageClient.get // Expose ZENDESK::CrossStorageClient:get
KanoSharedStorageClient.set // Expose ZENDESK::CrossStorageClient:set

TODO

Add tests.

Readme

Keywords

none

Package Sidebar

Install

npm i kano-shared-storage-client

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

18.4 kB

Total Files

11

Last publish

Collaborators

  • paulvarache