{"id":16081782,"url":"https://github.com/ginger-code/pollwatcher","last_synced_at":"2025-04-05T11:41:40.582Z","repository":{"id":144524886,"uuid":"331198031","full_name":"ginger-code/PollWatcher","owner":"ginger-code","description":"Register handler functions to polling methods","archived":false,"fork":false,"pushed_at":"2021-01-20T05:22:43.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T22:37:10.745Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ginger-code.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-20T05:02:37.000Z","updated_at":"2021-01-20T05:22:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"e37ff3d4-bb24-4dc0-85f9-fcd251ecb5e6","html_url":"https://github.com/ginger-code/PollWatcher","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"09b3544d4684ae274cc504f169feedb16d423db5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginger-code%2FPollWatcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginger-code%2FPollWatcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginger-code%2FPollWatcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ginger-code%2FPollWatcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ginger-code","download_url":"https://codeload.github.com/ginger-code/PollWatcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332521,"owners_count":20921852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T11:09:58.630Z","updated_at":"2025-04-05T11:41:40.563Z","avatar_url":"https://github.com/ginger-code.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PollWatcher\n\nPollWatcher provides a way to register handler delegates to poll-based monitoring solutions.\nThis enables event-driven development in scenarios where events are not provided and cannot easily be added.\nPossible use-cases include: polling a remote file server for changes, monitoring responses from an API, creating a recurring database task, etc.\nBuilt leveraging the System.Reactive namespace\n\n\nExample (C# 9.0 syntax): \n```c#\ninternal static class Program\n{\n    private static void Main()\n    {\n        using var watcher      = new PollWatcher\u003cDateTime\u003e(GetDate, interval, PrintDate, PrintException);\n        // using var asyncWatcher = new AsyncPollWatcher\u003cDateTime\u003e(GetDateAsync, interval, PrintDate, PrintException);\n        Thread.Sleep(5000);\n    }\n\n    // Returns a value that changes over time but must be retrieved synchronously\n    // In this case, it's the time\n    private static DateTime GetDate() =\u003e DateTime.Now;\n    \n    // Returns a value that changes over time but must be retrieved asynchronously\n    // In this case, it's the time\n    private static async Task\u003cDateTime\u003e GetDateAsync() =\u003e await Task.Run(() =\u003e DateTime.Now);\n\n    //Specifies polling should occur every .001ms (if possible)\n    private static TimeSpan interval = TimeSpan.FromMilliseconds(.001);\n\n    // \"Does stuff\" with the data retrieved from polling\n    // In this case, we print it to the console\n    private static void PrintDate(DateTime dateTime) =\u003e Console.WriteLine(dateTime.ToString(\"O\"));\n\n    // \"Does stuff\" with exceptions raised during polling\n    // In this case, we print it to the console\n    private static void PrintException(Exception exception) =\u003e Console.WriteLine($\"Exception!!!\\t{exception.Message}\");\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fginger-code%2Fpollwatcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fginger-code%2Fpollwatcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fginger-code%2Fpollwatcher/lists"}