diff --git a/examples/hello-poll.ts b/examples/hello-poll.ts index 494672a..a367a10 100644 --- a/examples/hello-poll.ts +++ b/examples/hello-poll.ts @@ -188,6 +188,7 @@ class MockPollingManager { await this.storage.set(`polling_config_${scheduleId}`, config); // Simulate scheduling + // eslint-disable-next-line no-console console.log(`Scheduled poll: ${scheduleId}`); return scheduleId; @@ -196,6 +197,7 @@ class MockPollingManager { // Main example async function runHelloPollExample(): Promise { + // eslint-disable-next-line no-console console.log('šŸš€ Starting Hello Poll Example'); // 1. Set up dependencies @@ -252,40 +254,50 @@ async function runHelloPollExample(): Promise { }; const scheduleId = await pollingManager.schedulePoll(scheduleConfig); + // eslint-disable-next-line no-console console.log(`āœ… Scheduled poll: ${scheduleId}`); // 4. Execute initial poll + // eslint-disable-next-line no-console console.log('šŸ“” Executing initial poll...'); const result = await pollingManager.executePoll(request); if (result.success && result.data) { + // eslint-disable-next-line no-console console.log(`āœ… Found ${result.data.data.length} changes`); if (result.data.data.length > 0) { // 5. Generate notifications const changes = result.data.data; + // eslint-disable-next-line no-console console.log('šŸ”” Generating notifications...'); if (changes.length === 1) { const project = changes[0].planSummary; + // eslint-disable-next-line no-console console.log(`šŸ“± Notification: "${project.name} has been updated"`); } else { + // eslint-disable-next-line no-console console.log(`šŸ“± Notification: "You have ${changes.length} new updates in your starred projects"`); } // 6. Update watermark with CAS const latestJwtId = changes[changes.length - 1].planSummary.jwtId; await storage.set('lastAckedStarredPlanChangesJwtId', latestJwtId); + // eslint-disable-next-line no-console console.log(`šŸ’¾ Updated watermark: ${latestJwtId}`); // 7. Acknowledge changes (simulate) + // eslint-disable-next-line no-console console.log('āœ… Acknowledged changes with server'); } } else { + // eslint-disable-next-line no-console console.log('āŒ Poll failed:', result.error?.message); } // 8. Simulate new data and poll again + // eslint-disable-next-line no-console console.log('\nšŸ”„ Adding new data and polling again...'); server.addNewData('1704153600_new123_0badf00d', 'Updated Hello Project'); @@ -295,25 +307,30 @@ async function runHelloPollExample(): Promise { const result2 = await pollingManager.executePoll(request); if (result2.success && result2.data) { + // eslint-disable-next-line no-console console.log(`āœ… Found ${result2.data.data.length} new changes`); if (result2.data.data.length > 0) { const project = result2.data.data[0].planSummary; + // eslint-disable-next-line no-console console.log(`šŸ“± New notification: "${project.name} has been updated"`); // Update watermark const latestJwtId = result2.data.data[result2.data.data.length - 1].planSummary.jwtId; await storage.set('lastAckedStarredPlanChangesJwtId', latestJwtId); + // eslint-disable-next-line no-console console.log(`šŸ’¾ Updated watermark: ${latestJwtId}`); } } + // eslint-disable-next-line no-console console.log('\nšŸŽ‰ Hello Poll Example completed successfully!'); } // Run the example if (require.main === module) { - runHelloPollExample().catch(console.error); + runHelloPollExample().catch(// eslint-disable-next-line no-console + console.error); } export { runHelloPollExample };