Appearance
Resolve Slot Page
The resolveSlotPage.js script is a required file in every extension archive. The platform calls this script each time it needs to render a slot, passing the current slot type, context, and extension settings. The script must return a key from views.pages to tell the platform which HTML page to load — or null to skip rendering.
How It Works
- The platform loads your extension for a specific slot.
- It calls the default export of
resolveSlotPage.jswith three arguments. - Your function returns a page key (a string matching a key in
views.pages) ornull. - If a key is returned, the platform loads the corresponding HTML file into the slot iframe.
- If
nullis returned, the slot is not rendered.
Function Signature
js
export default function resolveSlotPage(slotType, context, extSettings) {
// return a key from views.pages or null
}Arguments
| Argument | Type | Description |
|---|---|---|
slotType | TV1ExtensionSlot | A runtime slot constant indicating which slot is being resolved. |
context | TV1ExtContext | The current extension context containing model and/or user objects. |
extSettings | unknown | Extension settings saved by the model. See Extension Settings. |
TV1ExtensionSlot
The slotType argument receives one of the following values:
| Constant | Corresponds to manifest slot |
|---|---|
EXTENSION_SLOT_MAIN_GAME_FUN | mainGameFun |
EXTENSION_SLOT_MAIN_SEX_TOY | mainSexToy |
EXTENSION_SLOT_RIGHT_OVERLAY | rightOverlay |
EXTENSION_SLOT_MOVEABLE_OVERLAY | moveableOverlay |
EXTENSION_SLOT_BACKGROUND | background |
EXTENSION_SLOT_VIDEO_DECORATIVE_OVERLAY | videoDecorativeOverlay |
TV1ExtContext
The extension context contains information about the current model and/or user.
Canonical entity definitions live in the API reference:
If you need to load or track context outside of the resolver, see:
Return Value
The function must return either:
- A string — a key from
views.pagesin your manifest. The platform will load the corresponding HTML file. null— the platform will skip rendering for this slot.
If the function throws an error or returns a non-string value, the slot will not be rendered.
Basic Example
Given this manifest:
json
{
"version": "v2.0",
"views": {
"slots": ["EXTENSION_SLOT_MAIN_GAME_FUN",
"EXTENSION_SLOT_RIGHT_OVERLAY",
"EXTENSION_SLOT_BACKGROUND"],
"pages": {
"menu": "menu.html",
"overlay": "overlay.html",
"background": "background.html"
},
"resolveSlotPageScript": "resolveSlotPage.js"
}
}A simple resolver that maps each slot to a page:
js
// resolveSlotPage.js
export default function resolveSlotPage(slotType) {
switch (slotType) {
case 'EXTENSION_SLOT_MAIN_GAME_FUN':
return 'menu';
case 'EXTENSION_SLOT_RIGHT_OVERLAY':
return 'overlay';
case 'EXTENSION_SLOT_BACKGROUND':
return 'background';
default:
return null;
}
}Context-Aware Example
You can use context to return different pages depending on who is viewing — for example, showing different UI for models and viewers.
Given this manifest:
json
{
"version": "v2.0",
"views": {
"slots": ["EXTENSION_SLOT_MAIN_GAME_FUN",
"EXTENSION_SLOT_RIGHT_OVERLAY",
"EXTENSION_SLOT_BACKGROUND"],
"pages": {
"model-menu": "model-menu.html",
"viewer-menu": "viewer-menu.html",
"model-overlay": "model-overlay.html",
"viewer-overlay": "viewer-overlay.html",
"background": "background.html"
},
"resolveSlotPageScript": "resolveSlotPage.js"
}
}js
// resolveSlotPage.js
export default function resolveSlotPage(slotType, context) {
const isCurrentUserModel = context.user?.id === context.model?.id;
if (slotType === 'EXTENSION_SLOT_MAIN_GAME_FUN') {
return isCurrentUserModel ? 'model-menu' : 'viewer-menu';
}
if (slotType === 'EXTENSION_SLOT_RIGHT_OVERLAY') {
return isCurrentUserModel ? 'model-overlay' : 'viewer-overlay';
}
if (slotType === 'EXTENSION_SLOT_BACKGROUND') {
return 'background';
}
return null;
}In this case, views.pages includes separate page keys for models and viewers — "model-menu" / "viewer-menu" and "model-overlay" / "viewer-overlay" — each pointing to a different HTML file.
Settings-Aware Example
You can use extSettings to conditionally enable or disable slots based on model configuration.
Given this manifest:
json
{
"version": "v2.0",
"views": {
"settings": "settings.html",
"slots": ["EXTENSION_SLOT_MAIN_GAME_FUN",
"EXTENSION_SLOT_RIGHT_OVERLAY",
"EXTENSION_SLOT_BACKGROUND"],
"pages": {
"menu": "menu.html",
"overlay": "overlay.html",
"background": "background.html"
},
"resolveSlotPageScript": "resolveSlotPage.js"
}
}js
// resolveSlotPage.js
export default function resolveSlotPage(slotType, context, extSettings) {
if (slotType === 'EXTENSION_SLOT_MAIN_SEX_TOY') {
return 'main';
}
if (slotType === 'EXTENSION_SLOT_MOVEABLE_OVERLAY') {
return extSettings?.enableOverlay ? 'overlay' : null;
}
if (slotType === 'EXTENSION_SLOT_BACKGROUND') {
return 'background';
}
return null;
}TIP
Keep the resolver simple and fast. It runs every time the platform needs to resolve a slot, so avoid heavy logic or async operations.