Z ZPI 文档 v0.3.8
介绍页

源码

packages/desktop/src/renderer/editor-preference-storage.ts

typescript16 行查看原文
const preferenceKey = "zpi-last-editor-id";
export function readEditorPreference(storage: Pick<Storage, "getItem"> | null): string | null {
  try {
    return storage?.getItem(preferenceKey) || null;
  } catch {
    return null;
  }
}
export function saveEditorPreference(editorId: string, storage: Pick<Storage, "setItem"> | null): void {
  try {
    storage?.setItem(preferenceKey, editorId);
  } catch {
    /* Storage may be unavailable. */
  }
}