Storage

Summary

The Storage API allows Zoho Writer extensions to persistently store and retrieve data. There are two storage scopes: User Settings (per-user, cross-document) and Document Settings (per-document, scoped to a specific file).

Overview

  • Persist extension data between sessions
  • Store user preferences per user
  • Store document-specific data per document
  • Simple key-value based storage model

Storage Types

FeatureUser SettingsDocument Settings
ScopePer user (across all documents)Per document
PersistencePersists across documentsTied to specific document
Best ForUser preferences, API keys, themesDocument-specific data, annotations
API PrefixSigmaSDK.WRITER.storage.userSigmaSDK.WRITER.storage.document
Operationsfetch, add, deletefetch, add, delete

Sub-Sections

API Overview

User Settings API

// Fetch
SigmaSDK.WRITER.storage.user.fetch("key")

// Add / Update
SigmaSDK.WRITER.storage.user.add({ key: "key", value: "value" })

// Delete
SigmaSDK.WRITER.storage.user.delete("key")

Document Settings API

// Fetch
SigmaSDK.WRITER.storage.document.fetch("key")

// Add / Update
SigmaSDK.WRITER.storage.document.add({ key: "key", value: "value" })

// Delete
SigmaSDK.WRITER.storage.document.delete("key")

Choosing the Right Storage Type

  • Use User Settings for: language preferences, display themes, API credentials, user-specific settings that should apply to all documents
  • Use Document Settings for: document-level notes, per-document configurations, data that only makes sense in the context of a specific document

Related Pages