Pixso Open Documentation
guide
  • 中文
  • English
guide
  • 中文
  • English
  • Plugin API

    • Brief Introduction
    • Prerequisites
    • manifest
    • Development Guide
    • Change Log
    • Plugin API Documentation

      • Overview
      • Global Object

        • pixso
        • pixso.ui
        • pixso.host
        • pixso.mouse
        • pixso.editor
        • pixso.keyboard
        • pixso.fieldset
        • pixso.viewport
        • pixso.vectorEditor
        • pixso.clientStorage
        • pixso.serverStorage
      • Node Types

        • BooleanOperationNode
        • ComponentNode
        • ComponentSetNode
        • DocumentNode
        • EllipseNode
        • FrameNode
        • GroupNode
        • InstanceNode
        • LineNode
        • PageNode
        • PolygonNode
        • RectangleNode
        • SectionNode
        • SliceNode
        • StarNode
        • TextNode
        • VectorNode
      • Data Types

        • Action
        • ArcData
        • BlendMode
        • CommandItem
        • ComponentProperties-Related
        • Constraints
        • DialogType
        • DocumentationLink
        • Effect
        • EmbedData
        • ExportSettings
        • FontName
        • Guide
        • HandleMirroring
        • HyperlinkTarget
        • Image
        • LayoutGrid
        • LetterSpacing
        • Library
        • LineHeight
        • NodeChangeProperty
        • OverflowDirection
        • Overlay
        • Paint
        • PublishStatus
        • Reaction
        • Rect-related
        • RGB & RGBA
        • StrokeCap
        • StrokeJoin
        • StyleChangeProperty
        • TextCase
        • TextDecoration
        • TextListOptions
        • ThemeType
        • ToolType
        • Transition
        • Trigger
        • Vector
    • Host API Documentation

      • Overview
      • Host API
  • Open API

    • OpenAPI Doc

pixso.clientStorage

The pixso.clientStorage API allows plugins to store data locally to the user. Unlike document data storage (e.g. setPluginData), this data is not synchronized across users. It is similar to the Window.localStorage API, but it is asynchronous and allows storage of objects, arrays, strings, numbers, booleans, null, undefined and Uint8Array. as with Window.localStorage, user actions such as clearing the browser cache may clear all stored data.

The data stored in pixso.clientStorage is distinguished by the plugin Id, so the current plugin cannot read the data stored by other plugins, and if you need to share data across plugins, you can use the setSharedPluginData API.

The pixso.clientStorage API has four methods: getAsync, setAsync, deleteAsync, and keysAsync.

getAsync

  • Type: getAsync(key: string): Promise<any | undefined>

Retrieves a value from client storage with the given key. If no value has been stored for that key, this function will asynchronously return undefined.

setAsync

  • Type: setAsync(key: string, value: any): Promise<void>

Sets a value to client storage with the given key. The returned promise will resolve if storage is successful, or reject with an error message if storage failed.

deleteAsync

  • Type: deleteAsync(key: string): Promise<void>

Removes the stored key/value pair from client storage with the given key. If no such key is stored, this function will return normally but will otherwise do nothing.

keysAsync

  • Type: keysAsync(): Promise<string[]>

Retrieves a list of all keys stored to client storage. Use this to enumerate the full contents of the clientStorage API.

Prev
pixso.vectorEditor
Next
pixso.serverStorage