Are you an LLM? You can read better optimized documentation at /developers/docs/embed/api/core.md for this page in Markdown format
Core Methods
Essential methods for embed initialization and configuration
Methods
ready()
Wait for the embed to be ready
Returns a promise that resolves when the embed iframe has fully loaded and communication with the Flat embed has been established. This method is automatically called by all other embed methods, so you typically don't need to call it directly. However, it can be useful when you want to know exactly when the embed is ready without performing any other action.
typescript
ready(): Promise<void>Returns: Promise<void>
Examples:
typescript
// Explicitly wait for embed to be ready
const embed = new Embed('container', {
score: '56ae21579a127715a02901a6'
});
await embed.ready();
console.log('Embed is now ready!');Note: All embed methods automatically call ready() internally, so explicit calls are optional
getEmbedConfig()
Get the embed configuration
Retrieves the complete configuration object for the embed, including display settings, permissions, editor configuration, and enabled features.
typescript
getEmbedConfig(): Promise<Record<string, unknown>>Returns: Promise<Record<string, unknown>>
Throws:
Error- If the configuration cannot be retrieved
Examples:
typescript
// Get current embed configuration
const config = await embed.getEmbedConfig();
console.log(`Mode: ${config.mode}`);
console.log(`Controls enabled: ${config.controlsPlay}`);setEditorConfig()
Set the editor configuration
Updates the editor configuration for the embed. These settings control various aspects of the editor interface and behavior. The configuration is applied when the next score is loaded.
typescript
setEditorConfig(editor: Record<string, unknown>): Promise<void>Parameters:
editor-Record<string, unknown>
Returns: Promise<void>
Throws:
Error- If the configuration is invalid
Example:
typescript
const embed = new Embed('container', config);
await embed.setEditorConfig('value');Note: This configuration persists across score loads until changed