Handles the end of a poll by emitting an "endPoll" event through the provided socket. Displays an alert based on the success or failure of the operation.

The options for ending the poll.

The ID of the poll to end.

The socket instance to emit the event.

Optional function to display alerts.

The name of the room where the poll is being conducted.

Function to update the visibility of the poll modal.

A promise that resolves when the poll end operation is complete.

Will log an error if the operation fails to emit the end poll event.

const handleEndPollService = new HandleEndPoll();
const pollId = '12345';
await handleEndPollService.handleEndPoll({
pollId: pollId,
socket: socketInstance,
roomName: 'room1',
showAlert: ({ message, type }) => {
console.log(`Alert: ${message} - Type: ${type}`);
},
updateIsPollModalVisible: (isVisible) => {
console.log('Poll modal visibility:', isVisible);
},
});

Constructors

Methods

Constructors

Methods

  • Handles the end of a poll by emitting an "endPoll" event through the provided socket. Displays an alert based on the success or failure of the operation.

    Parameters

    Returns Promise<void>

    A promise that resolves when the poll end operation is complete.