{"id":18859572,"url":"https://github.com/tortitast/tevent","last_synced_at":"2026-04-29T08:33:51.259Z","repository":{"id":65150987,"uuid":"581505914","full_name":"TortitasT/tevent","owner":"TortitasT","description":"Event system for deno","archived":false,"fork":false,"pushed_at":"2022-12-29T22:03:47.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T00:15:30.725Z","etag":null,"topics":["deno"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TortitasT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-23T11:40:26.000Z","updated_at":"2024-01-04T08:44:13.000Z","dependencies_parsed_at":"2023-01-03T20:32:02.525Z","dependency_job_id":null,"html_url":"https://github.com/TortitasT/tevent","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TortitasT%2Ftevent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TortitasT%2Ftevent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TortitasT%2Ftevent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TortitasT%2Ftevent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TortitasT","download_url":"https://codeload.github.com/TortitasT/tevent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239800488,"owners_count":19699127,"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":["deno"],"created_at":"2024-11-08T04:18:30.499Z","updated_at":"2026-02-08T14:30:17.093Z","avatar_url":"https://github.com/TortitasT.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tevent\n\nTortitas Event is a simple Observer pattern implementation for Deno.\n\n## Usage\n\nYou can use it in two ways, either by implementing the Listener interface or by passing a function to the listen method.\n\n### Implementing the Listener interface\n```ts\nimport { Event, Listener } from \"https://deno.land/x/tevent/mod.ts\";\n\nconst event = new Event();\n\nclass Sample implements Listener {\n  public update(data: any): void {\n    console.log(data);\n  }\n}\n\nconst sample = new Sample();\n\nevent.listen(sample);\n\nevent.notify(\"Hello World!\"); // This will be printed\n\nevent.unlisten(sample);\n\nevent.notify(\"Hello World!\"); // This will not be printed\n```\n\n### Passing a function to the listen method\n#### Note: If you pass a function to the listen method, you must pass the same function to the unlisten method.\n```ts\nimport { Event } from \"https://deno.land/x/tevent/mod.ts\";\n\nconst event = new Event();\n\nevent.listen((data: any) =\u003e {\n  console.log(data);\n});\n\nevent.notify(\"Hello World!\"); // This will be printed\n\nevent.unlisten((data: any) =\u003e {\n  console.log(data);\n});\n\nevent.notify(\"Hello World!\"); // This will not be printed\n```\n\n#### Note: If you use a function from an object you must use .bind() to pass the correct context to the function.\n```ts\nimport { Event } from \"https://deno.land/x/tevent/mod.ts\";\n\nconst event = new Event();\n\nclass Sample {\n  public print(data: any): void {\n    console.log(data);\n  }\n}\n\nconst sample = new Sample();\n\nevent.listen(sample.print.bind(sample));\n\nevent.notify(\"Hello World!\"); // This will be printed\n\nevent.unlisten(sample.print.bind(sample));\n\nevent.notify(\"Hello World!\"); // This will not be printed\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftortitast%2Ftevent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftortitast%2Ftevent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftortitast%2Ftevent/lists"}