{"id":49073268,"url":"https://github.com/kitstack/eventkit","last_synced_at":"2026-04-20T08:12:47.351Z","repository":{"id":175984743,"uuid":"638753309","full_name":"kitstack/eventkit","owner":"kitstack","description":"Eventkit package provides event-driven programming in Go for managing and triggering events with ease.","archived":false,"fork":false,"pushed_at":"2023-06-19T21:11:52.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-02T23:35:57.984Z","etag":null,"topics":["event","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","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/kitstack.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}},"created_at":"2023-05-10T03:09:55.000Z","updated_at":"2023-06-19T02:29:34.000Z","dependencies_parsed_at":"2024-02-12T02:02:38.286Z","dependency_job_id":null,"html_url":"https://github.com/kitstack/eventkit","commit_stats":null,"previous_names":["kitstack/eventkit","jackgianesini/eventkit"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/kitstack/eventkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Feventkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Feventkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Feventkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Feventkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kitstack","download_url":"https://codeload.github.com/kitstack/eventkit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitstack%2Feventkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32038608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["event","golang"],"created_at":"2026-04-20T08:12:46.560Z","updated_at":"2026-04-20T08:12:47.343Z","avatar_url":"https://github.com/kitstack.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go](https://github.com/kitstack/eventkit/actions/workflows/coverage.yml/badge.svg)](https://github.com/kitstack/eventkit/actions/workflows/coverage.yml)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/kitstack/eventkit)\n[![Go Report Card](https://goreportcard.com/badge/github.com/kitstack/eventkit)](https://goreportcard.com/report/github.com/kitstack/eventkit)\n[![codecov](https://codecov.io/gh/kitstack/eventkit/branch/main/graph/badge.svg?token=3JRL5ZLSIH)](https://codecov.io/gh/kitstack/eventkit)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kitstack/eventkit/blob/main/LICENSE)\n[![Github tag](https://badgen.net/github/release/kitstack/eventkit)](https://github.com/kitstack/eventkit/releases)\n\n# Overview\n\nThe `eventkit` package provides a simple event-driven programming mechanism in Go. It allows you to create and manage events, subscribe to events using struct methods or functions, and trigger events with optional data.\n\n## Usage\n\n### Creating a new event instance\n\nTo create a new event instance, use the `New()` function:\n\n```go\neventInstance := eventkit.New()\n```\n\n### Subscribing to an event\n\n#### Using struct methods\n\nTo subscribe to an event using struct methods, use the `Subscribe()` function. It takes a struct instance as the payload and automatically registers all methods starting with a specified prefix (default: \"On\") as event listeners.\n\n```go\ntype MyEventPayload struct {\n\t// struct fields\n}\n\nfunc (m *MyEventPayload) OnEventName() {\n\t// event handler logic\n}\n\n// Subscribe to the event\neventInstance.Subscribe(\u0026MyEventPayload{})\n```\n\n#### Using functions\n\nTo subscribe to an event using a function, use the `SubscribeFunc()` function. Provide a unique listener identifier and the callback function.\n\n```go\nfunc myEventListener(data ...interface{}) {\n\t// event handler logic\n}\n\n// Subscribe to the event\neventInstance.SubscribeFunc(\"myListener\", myEventListener)\n```\n\n### Triggering an event\n\nTo trigger an event, use the `Trigger()` function. Provide the name of the event and optional data as arguments.\n\n```go\nerr := eventInstance.Trigger(\"eventName\", eventData)\nif err != nil {\n\t// handle error\n}\n```\n\nNote: The package utilizes various external dependencies, such as `logrus`, `golang.org/x/text/cases`, and `sync`, among others.\n\nFor more details on the package, please refer to the code documentation and comments within the source files.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitstack%2Feventkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitstack%2Feventkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitstack%2Feventkit/lists"}