Pixso 开放文档
插件 API
官方工具集
  • 中文
  • English
插件 API
官方工具集
  • 中文
  • English
  • 插件 API

    • 简介
    • 预备知识
    • manifest
    • 开发指南
    • 更新日志
    • Plugin API 文档

      • 概述
      • 全局对象

        • pixso
        • pixso.ui
        • pixso.host
        • pixso.mouse
        • pixso.editor
        • pixso.keyboard
        • pixso.fieldset
        • pixso.viewport
        • pixso.vectorEditor
        • pixso.stickyToolbar
        • pixso.clientStorage
        • pixso.serverStorage
      • 节点类型

        • BooleanOperationNode
        • ComponentNode
        • ComponentSetNode
        • DocumentNode
        • EllipseNode
        • FrameNode
        • GroupNode
        • InstanceNode
        • LineNode
        • PageNode
        • PolygonNode
        • RectangleNode
        • SectionNode
        • SliceNode
        • StarNode
        • TextNode
        • VectorNode
      • 样式类型

        • PaintStyle
        • TextStyle
        • EffectStyle
        • GridStyle
      • 数据类型

        • 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
        • StickyToolbar
        • StrokeCap
        • StrokeJoin
        • StyleChangeProperty
        • TextCase
        • TextDecoration
        • TextListOptions
        • ThemeType
        • ToolType
        • Transition
        • Trigger
        • Vector
    • Host API 文档

      • 概述
      • Host API
  • 服务端 API

    • OpenAPI 文档
    • OpenAPI 文档
    • 事件订阅
    • 事件订阅
  • 客户端 API

    • 简介
    • 唤醒客户端
    • Web API
    • 更新日志

pixso.clientStorage

pixso.clientStorage API 允许插件将数据存储在用户的本地。与文档数据存储(例如 setPluginData )不同,此数据不会跨用户同步。它类似于 Window.localStorage API,但它是异步的,并允许存储对象、数组、字符串、数字、布尔值、null、undefined 和Uint8Array。如同 Window.localStorage, 清除浏览器缓存等用户操作可能会清除所有存储的数据。

pixso.clientStorage 存储的数据根据插件 Id 进行区分,因此当前插件无法读取其他存储的数据,如果需要跨插件共享数据,可以使用 setSharedPluginData API。

pixso.clientStorage API 的读写删除操作都是异步,有 getAsync 、 setAsync 、deleteAsync 、 keysAsync 四个方法。

getAsync

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

根据键 key 从 clientStorage 存储中检索对应的值。如果该键没有存储任何值,则异步返回 undefined。

setAsync

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

在 clientStorage 给键 key 存储值value,当存储成功,则 Promise 将会 resolve(),否则将会 reject()

deleteAsync

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

根据键 key 删除 clientStorage 相应存储的键值对。

keysAsync

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

检索存储到 clientStorage 所有键值对,返回键列表,可以使用它来枚举 clientStorage API 存储的全部内容。

Prev
pixso.stickyToolbar
Next
pixso.serverStorage