top of page

رقم التذكرة 

رقم الخدمة

في الخدمة الان

00:00 / 00:03

A

000

0

0

0

.

مستشفى المضة العام

logo.png
تذكرة رقم

0

التوجه الى

0

.
.
bottom of page
import { getAnnouncementText } from 'backend/WebSpeech'; // Replace with your module name $w.onReady(() => { // Access the button and HTML component const startButton = $w('#startButton'); const htmlComponent = $w('#speechTrigger'); const innerDiv = htmlComponent.$children[0]; // Access the inner
// Add a click event listener to the button startButton.onClick(() => { // Call the backend function to get the announcement text getAnnouncementText().then((text) => { // Update the inner
with the text innerDiv.innerText = text; speakText(text); // Call the Web Speech API function }); }); }); // Function to speak text using the Web Speech API function speakText(text) { if ('speechSynthesis' in window) { const utterance = new SpeechSynthesisUtterance(text); utterance.volume = 1; // Volume (0 to 1) utterance.rate = 1; // Speed (0.1 to 10) utterance.pitch = 1; // Pitch (0 to 2) window.speechSynthesis.speak(utterance); } else { console.error("Your browser does not support the Web Speech API."); } } $w.onReady(() => { // Access the HTML component by its ID const htmlComponent = $w('#speechTrigger'); const innerDiv = htmlComponent.$children[0]; // First child element // Add an event listener to the inner
innerDiv.addEventListener('change', (event) => { const text = event.target.innerText; speakText(text); // Call the Web Speech API function }); // Call the backend function to get the announcement text getAnnouncementText().then((text) => { // Update the inner
with the text innerDiv.innerText = text; innerDiv.dispatchEvent(new Event('change')); // Trigger the event }); }); // Function to speak text using the Web Speech API function speakText(text) { if ('speechSynthesis' in window) { const utterance = new SpeechSynthesisUtterance(text); utterance.volume = 1; // Volume (0 to 1) utterance.rate = 1; // Speed (0.1 to 10) utterance.pitch = 1; // Pitch (0 to 2) window.speechSynthesis.speak(utterance); } else { console.error("Your browser does not support the Web Speech API."); } }