Skip to content

Web API

Integration Notes

These APIs are only available in the Pixso desktop client. Open the client configuration address, configure the target URL, and then connect to the Pixso desktop client APIs.

During development, configure your own local URL for debugging.

Web API

The web side exposes a built-in Pixso object named pixsoDesktopJSAPI. All APIs are called through this object.

Check whether the current environment is Pixso desktop

js
// Whether the current environment is the Pixso desktop client.
const isPixsoDesktop = window.pixsoDesktopJSAPI;

Get the current client version

js
// Get the client version.
const version = pixsoDesktopJSAPI.version;

Open a tab

js
// Open a tab.
pixsoDesktopJSAPI.viewPostMessageToMainProcess("openTab", {
  url,
  title,
  isNewTab,
  icon_type,
});
  • url: string Required. The URL to open in the tab. Example file URL: https://pixso.cn/app/editor/_P0wo93-6euk362Skk421g?showQuickFrame=true&icon_type=1&page-id=0%3A1.
  • title: string Optional. The title of the new tab.
  • isNewTab: boolean Optional. Defaults to true. Whether to open a new tab.
  • icon_type: number Optional. Defaults to -1. Values: -1 means no icon, 1 means design file, 2 means prototype file, and 3 means whiteboard file.

Close a tab

js
// Close the current tab.
pixsoDesktopJSAPI.viewPostMessageToMainProcess("closeView");

Open the home page

js
// Open the home page.
pixsoDesktopJSAPI.viewPostMessageToMainProcess("showHomepage");