View source

Pondiverse - Reference

This page lists all of the functions that are available to use from the pondiverse script.

For guides, go to the learn page.
For an example tool, look at the basic tool page.


addPondiverseButton(getCreation, { store? })

Add the pondiverse button to your tool.

import { addPondiverseButton } from "https://www.pondiverse.com/pondiverse.js";

addPondiverseButton(() => {
  return {
    title: "My example creation",
    type: "example",
    data: "example data",
    image: canvas?.toDataURL("image/png"),
  };
});


openPondiverseDialog(getCreation, { store? })

Programmatically open the pondiverse dialog.

import { openPondiverseDialog } from "https://www.pondiverse.com/pondiverse.js";

openPondiverseDialog(() => {
  return {
    title: "My example creation",
    type: "example",
    data: "example data",
    image: canvas?.toDataURL("image/png"),
  };
});


fetchPondiverseCreations({ store? })

Fetch all creations from an store.

import { fetchPondiverseCreations } from "https://www.pondiverse.com/pondiverse.js";

const creations = await fetchPondiverseCreations();


fetchPondiverseCreation(creation, { store? })

Fetch a single creation.

import { fetchPondiverseCreation } from "https://www.pondiverse.com/pondiverse.js";

const creation = await fetchPondiverseCreation(123);

You can also pass in a creation url instead of an ID. This means you can use IDs and URLs interchangeably in your code.

import { fetchPondiverseCreation } from "https://www.pondiverse.com/pondiverse.js";
const creation = await fetchPondiverseCreation(
  "https://pondiverse.val.run/get-creation?id=123"
);


deletePondiverseCreation(creation, { password?, store? })

Delete a creation.

import { deletePondiverseCreation } from "https://www.pondiverse.com/pondiverse.js";

await deletePondiverseCreation(123, {
  password: "password",
});


getPondiverseCreationImage(creation, { store? })

Get the image URL of a creation. This will eventually be deprecated, when the URL of a creation’s image will be returned within fetchPondiverseCreation and fetchPondiverseCreations.

import { getPondiverseCreationImage } from "https://www.pondiverse.com/pondiverse.js";

const creation = await fetchPondiverseCreation(123);
const imageUrl = getPondiverseCreationImage(creation);


Store

Most functions have an optional store option. This determines the store to use when publishing and fetching creations. If not specified, it defaults to the todepondiverse.

The store option is an object with the following properties. All are optional.