Skip to content

API - Globals

Classes

BasePlugin

This class is meant to be subclassed by your own plugin class. It provides lifecycle events and access to APIs used for interacting with the Vatom Spaces environment. See Creating A Plugin for more information.

Method/Field                       Description
onLoad() Called when the plugin is loaded
onSettingsUpdated(field, value) Called when a user has changed a setting in the plugin
onUnload() Called when the plugin is unloaded
onMessage(data) Called when a remote instance uses this.messages.send(data)
onRequest(data) Called when a remote instance uses this.messages.request(data). You can return a value, and this function can be async
getField(id) Get a configuration field value for this plugin
audio See Audio
hooks See Hooks
menus See Menus
messages See Messages
objects See Objects
paths See Paths
user See User
world See World

BaseComponent

This class is meant to be subclassed by your own component class. It provides access to the object the component is attached to. See Creating A Component for more information.

Method/Field                             Description
onLoad() Called when the component is loaded
onObjectUpdated(newFields) Called when the attached object's fields have changed
onUnload() Called when the component is unloaded
onAction(id) Called when the user clicks on an action button
onClick() Called when the user clicks on the attached object
onMessage(data) Called when a remote instance uses this.sendMessage(data)
onRequest(data) Called when a remote instance uses this.sendRequest(data). You can return a value, and this function can be async
getField(id) Gets the value of a user-configurable setting field. See this.objects.registerComponent() for more info
sendMessage(data) Calls onMessage(data) in all remote instances of this component
sendRequest(data) Calls onRequest(data) in all remote instances of this component, and returns the first truthy value
plugin A reference to the main plugin which registered this component
objectID The ID of the attached object
fields The attached object's fields
Back to top