Getting Started

Pre-requisites

API access

Note that the Vulp API is exclusively available for enterprise customers and requires activation by the Vulp team.

Integration

Integrating the Vulp JavaScript API

To include the JavaScript API in a web application, add the following code to a JavaScript file loaded by your application.

Example
import('https://api.vulp.studio/v1/api.js')
    .then(async ({ VulpApi }) => {
      // Your code here
    })
    .catch(err => {
      console.error(err);
    });

Initializing the API

Once the VulpApi is loaded, initialize the API using the initialize method before use.

Example
  await VulpApi.initialize();

Registering a model

Interaction with a Vulp model requires registration with the VulpApi. Register a model using the initialize method, providing the iframe containing the Vulp model as a parameter.

The Vulp JavaScript API supports registering multiple models.

Example
  const model = await VulpApi.registerModel(
    document.querySelector('iframe') as HTMLIFrameElement
  );

Listening for messages

After registering the model it is possible to setup listeners for messages. The following listeners can be registered:

Refer to the appropriate technical docs for detailed information.

Example
model
  .onReady(({ model, view, apiVersion }) => {
      // Model is ready to accept commands
  })
  .onModelUpdated(({ model }) => {
    console.log(model);
  })

Sending commands

The JavaScript API enables sending commands to the Vulp model. The following commands are available:

Please consult the appropriate technical docs for detailed information.

Example
const { activated } = await model.activateAr();

Getting information

At any time (after the API has been initialized) is it possible to retrieve information from the model.

Example
const { model } = await model.getModelConfig();

Technical documentation

Full technical documentation can be found under @vulp/js-api.