Instantiate a new instance of World class for interacting with a specific Topia world.
Optional
options: WorldOptionalInterfaceReturns a new World object for interacting with the specified world.
This method creates a controller instance for a world identified by its URL slug. The world controller can be used to fetch details, update world settings, and perform other world-level operations.
// Import the pre-initialized factory from your app's initialization file
import { World } from "utils/topiaInit.ts";
// Create a World instance with credentials
const worldInstance = World.create(
"my-world-slug",
{
credentials: {
interactiveNonce,
interactivePublicKey,
assetId,
urlSlug,
visitorId
}
}
);
// Fetch world details
await worldInstance.fetchDetails();
console.log(worldInstance.name);
Deletes multiple dropped assets from a world in a single operation.
Returns { success: true }
if all assets were deleted successfully.
This method provides a convenient way to delete multiple dropped assets at once rather than deleting them one by one. Requires appropriate permissions via interactive credentials.
// Import the pre-initialized factory from your app's initialization file
import { World } from "utils/topiaInit.ts";
// Delete multiple dropped assets from a world
const result = await World.deleteDroppedAssets(
"my-world-slug",
["asset-id-123", "asset-id-456", "asset-id-789"],
"your-interactive-secret",
{
apiKey: "your-api-key",
interactivePublicKey: "your-public-key",
visitorId: 12345
}
);
if (result.success) {
console.log("Assets successfully deleted");
}
Factory for creating World instances. Use this factory to interact with Topia worlds.
Remarks
This factory should be instantiated once per application and reused across your codebase. The World controller provides methods to manage world settings, retrieve world details, and perform world-level operations.
Keywords
world, factory, create, virtual space, environment, room, topia
Example