await session.layouts.showTextWall('Hello World!');// With optionsawait session.layouts.showTextWall('Important message', { durationMs: 5000 // Show for 5 seconds});
Long text automatically wraps, but you can control it:
Copy
function wrapText(text: string, maxLength: number = 30): string { const words = text.split(' '); const lines = []; let currentLine = ''; for (const word of words) { if (currentLine.length + word.length > maxLength) { lines.push(currentLine); currentLine = word; } else { currentLine += (currentLine ? ' ' : '') + word; } } if (currentLine) lines.push(currentLine); return lines.join('\n');}// Usageconst wrapped = wrapText('This is a very long text that needs wrapping');await session.layouts.showTextWall(wrapped);
// Enable dashboardawait session.dashboard.write({ text: 'Translator Active'});// Set dashboard modeawait session.dashboard.mode.set({ enabled: true, alwaysOn: true // Keep visible even when other apps show content});
// Badawait session.layouts.showTextWall( 'The current temperature reading from the sensor is seventy-two degrees');// Goodawait session.layouts.showTextWall('72°F');
Use appropriate layouts
Choose the right layout for your content:
Copy
// For simple messagessession.layouts.showTextWall('Hello!');// For structured datasession.layouts.showReferenceCard({ title: 'Weather', text: 'Sunny, 72°F'});// For comparisonssession.layouts.showDoubleTextWall( 'Expected: 100', 'Actual: 95');
Handle display timeouts
Content disappears after the duration:
Copy
// Show important message longerawait session.layouts.showTextWall('Emergency Alert!', { durationMs: 10000 // 10 seconds});// Or refresh periodicallyconst interval = setInterval(() => { session.layouts.showTextWall('Still active...');}, 4000);