{"id":15792730,"url":"https://github.com/nfour/yaef","last_synced_at":"2026-01-20T00:33:35.465Z","repository":{"id":41786629,"uuid":"177077724","full_name":"nfour/yaef","owner":"nfour","description":"Yet Another Event Framework","archived":false,"fork":false,"pushed_at":"2023-01-03T18:28:29.000Z","size":1068,"stargazers_count":2,"open_issues_count":15,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-11T23:16:09.866Z","etag":null,"topics":[],"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/nfour.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":"2019-03-22T05:36:14.000Z","updated_at":"2020-04-20T00:54:16.000Z","dependencies_parsed_at":"2023-02-01T08:45:25.731Z","dependency_job_id":null,"html_url":"https://github.com/nfour/yaef","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfour%2Fyaef","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfour%2Fyaef/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfour%2Fyaef/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfour%2Fyaef/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nfour","download_url":"https://codeload.github.com/nfour/yaef/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247619809,"owners_count":20968047,"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-04T23:03:21.257Z","updated_at":"2026-01-20T00:33:35.431Z","avatar_url":"https://github.com/nfour.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YAEF: Yet Another Event Framework\n\n**Features:**\n- Useful type validation for evented architectures\n- IPC communication, including a **Registry**\n- Clearly defined event model\n\n+ [Usage](#usage)\n+ [Example](#example)\n+ [Documented example](#documented-example)\n\n## Usage\n\n- If you are utilizing `RemoteModuleComponent` then:\n  - You must set an environment variable:\n    - `NODE_OPTIONS=--experimental-worker`\n  - Requires NodeJS `\u003e= 10.5.0`\n\n## Example\n\nIt looks something like this:\n\n```ts\nimport { Component, ComponentMediator, ComponentSignature, EventSignature } from '@yaef/core';\n\ntype IFruitTypes = 'Apple' | 'Banana';\n\n// Create some event signatures\n\nconst ItIsANewDay = EventSignature('ItIsANewDay')\nconst FruitIsRipe = EventSignature('IsRipe', { fruit: \u003cIFruitTypes\u003e '' });\n\n// Or:\nconst HarvestedFruit = { name: \u003cconst\u003e 'HarvestedFruit', fruit: \u003cIFruitTypes\u003e '' };\n\n// Create some component signatures\n\nconst Apple = ComponentSignature('Apple', {\n  observations: [ItIsANewDay],\n  publications: [FruitIsRipe],\n});\n\n// Or:\nconst Harvester = {\n  name: \u003cconst\u003e 'Harvester',\n  observations: [FruitIsRipe],\n  publications: [HarvestedFruit],\n};\n\n// Create some components\n\nconst harvester = Component(Harvester, (m) =\u003e {\n  m.observe(FruitIsRipe, ({ fruit }) =\u003e {\n    fruit; // IFruitTypes\n    m.publish(HarvestedFruit, { fruit });\n  });\n});\n\nconst apple = Component(Apple, (m) =\u003e {\n  m.observe(ItIsANewDay, () =\u003e {\n    if (true) { /** pretend this is doing something... */\n      m.publish(FruitIsRipe, { fruit: 'Apple' });\n    }\n  });\n});\n\n\nconst { disconnect, connect, mediator } = ComponentMediator({\n  components: [apple, harvester]\n});\n\n// The components are initialized with the mediator\nawait connect();\n\n// Emit some events.\n\nfunction theEarthRotates () {\n  mediator.publish(ItIsANewDay);\n}\n\nasync function theEarthExplodes () {\n  clearTimeout(dayInterval);\n\n  await disconnect(); // If components need to gracefully die, they can here\n}\n\nconst dayInterval = setInterval(theEarthRotates, 1000); // That is a bit fast\n\nsetTimeout(theEarthExplodes, 20000);\n```\n\n## Documented example\n\n- (WIP) [./docs/overview.ts](./docs/overview.ts)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfour%2Fyaef","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnfour%2Fyaef","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfour%2Fyaef/lists"}