跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.supernote.com/llms.txt

Use this file to discover all available pages before exploring further.

该接口会根据元素 uuid 获取缓存的 Element 数据(包含笔划、链接、标题、几何图形与文本框等)。
调用 clearElementCache() 清空缓存后,旧的 Element 对象/uuid 将无法再用于读取缓存数据。
static getCacheElement(uuid: string): Promise<APIResponse<Element>>;
参数
参数类型说明
uuidstring元素 UUID
返回

示例

import { PluginCommAPI } from 'sn-plugin-lib';

/**
 * 根据 uuid 获取缓存 Element 的示例。
 */
export async function exampleGetCacheElement(uuid: string) {
  const res = (await PluginCommAPI.getCacheElement(uuid)) as any;
  if (!res.success) {
    console.log('getCacheElement failed', res.error);
    throw new Error(res.error?.message ?? 'getCacheElement 调用失败');
  }
  console.log('getCacheElement result', res.result);
  return res.result;
}