{"id":17114631,"url":"https://github.com/adobe-webplatform/eve","last_synced_at":"2025-05-15T20:00:57.492Z","repository":{"id":801293,"uuid":"503009","full_name":"adobe-webplatform/eve","owner":"adobe-webplatform","description":"Custom events… ","archived":false,"fork":false,"pushed_at":"2017-04-19T12:07:39.000Z","size":45,"stargazers_count":317,"open_issues_count":12,"forks_count":112,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-14T18:55:34.754Z","etag":null,"topics":["events","javascript"],"latest_commit_sha":null,"homepage":"http://dmitry.baranovskiy.com/eve/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adobe-webplatform.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}},"created_at":"2010-02-04T22:24:34.000Z","updated_at":"2025-03-08T10:54:01.000Z","dependencies_parsed_at":"2022-07-09T13:00:26.183Z","dependency_job_id":null,"html_url":"https://github.com/adobe-webplatform/eve","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe-webplatform%2Feve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe-webplatform%2Feve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe-webplatform%2Feve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adobe-webplatform%2Feve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adobe-webplatform","download_url":"https://codeload.github.com/adobe-webplatform/eve/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414457,"owners_count":22067263,"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":["events","javascript"],"created_at":"2024-10-14T17:19:32.813Z","updated_at":"2025-05-15T20:00:56.806Z","avatar_url":"https://github.com/adobe-webplatform.png","language":"JavaScript","readme":"# Eve\n\nTiny event helping JavaScript library.\n\n## eve(name, scope, varargs)\nFires event with given `name`, given scope and other parameters.\n\n### Parameters\n- _name_  **string**\n    name of the _event_, dot (`.`) or slash (`/`) separated\n- _scope_  **object**\n    context for the event handlers\n- _varargs_  **...**\n    the rest of arguments will be sent to event handlers\n\n**Returns:**  **object** array of returned values from the listeners. Array has two methods `.firstDefined()` and `.lastDefined()` to get first or last not `undefined` value.\n\n## eve.listeners(name)\nInternal method which gives you array of all event handlers that will be triggered by the given `name`.\n\n### Parameters\n- _name_  **string**\n    name of the event, dot (`.`) or slash (`/`) separated\n\n**Returns:**  **array** array of event handlers\n\n## eve.separator(separator)\nIf for some reasons you don’t like default separators (`.` or `/`) you can specify yours\nhere. Be aware that if you pass a string longer than one character it will be treated as\na list of characters.\n\n### Parameters\n- _separator_  **string**\n    new separator. Empty string resets to default: `.` or `/`.\n\n\n## eve.on(name, f, name, f)\nBinds given event handler with a given name. You can use wildcards “`*`” for the names:\n\n```js\neve.on(\"*.under.*\", f);\neve(\"mouse.under.floor\"); // triggers f\n```\nUse \u003ca href=\"#eve\" class=\"dr-link\"\u003eeve\u003c/a\u003e to trigger the listener.\n\n### Parameters\n- _name_  **string**\n    name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards\n- _f_  **function**\n    event handler function\n- _name_  **array**\n    if you don’t want to use separators, you can use array of strings\n- _f_  **function**\n    event handler function\n\n**Returns:**  **function** returned function accepts a single numeric parameter that represents z-index of the handler. It is an optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment.\n\n### Example:\n```js\neve.on(\"mouse\", eatIt)(2);\neve.on(\"mouse\", scream);\neve.on(\"mouse\", catchIt)(1);\n```\nThis will ensure that `catchIt` function will be called before `eatIt`.\n\nIf you want to put your handler before non-indexed handlers, specify a negative value.\nNote: I assume most of the time you don’t need to worry about z-index, but it’s nice to have this feature “just in case”.\n\n\n## eve.f(event, varargs)\nReturns function that will fire given event with optional arguments.\nArguments that will be passed to the result function will be also\nconcated to the list of final arguments.\n\n```js\nel.onclick = eve.f(\"click\", 1, 2);\neve.on(\"click\", function (a, b, c) {\n    console.log(a, b, c); // 1, 2, [event object]\n});\n```\n### Parameters\n- _event_  **string**\n    event name\n- _varargs_  **…**\n    and any other arguments\n\n**Returns:**  **function** possible event handler function\n\n## eve.stop()\nIs used inside an event handler to stop the event, preventing any subsequent listeners from firing.\n\n\n## eve.nt([subname])\nCould be used inside event handler to figure out actual name of the event.\n\n### Parameters\n- _subname_  **string**\n    subname of the event\n\n**Returns:**  **string** name of the event, if `subname` is not specified\nor\n\n**Returns:**  **boolean** `true`, if current event’s name contains `subname`\n\n## eve.nts()\nCould be used inside event handler to figure out actual name of the event.\n\n**Returns:**  **array** names of the event\n\n## eve.off(name, f)\nRemoves given function from the list of event listeners assigned to given name.\nIf no arguments specified all the events will be cleared.\n\n### Parameters\n- _name_  **string**\n    name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards\n- _f_  **function**\n    event handler function\n\n\n## eve.unbind()\nSee \u003ca href=\"#eve.off\" class=\"dr-link\"\u003eeve.off\u003c/a\u003e\n\n\n## eve.once(name, f)\nBinds given event handler with a given name to only run once then unbind itself.\n\n```js\neve.once(\"login\", f);\neve(\"login\"); // triggers f\neve(\"login\"); // no listeners\n```\nUse \u003ca href=\"#eve\" class=\"dr-link\"\u003eeve\u003c/a\u003e to trigger the listener.\n\n### Parameters\n- _name_  **string**\n    name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards\n- _f_  **function**\n    event handler function\n\n**Returns:**  **function** same return function as \u003ca href=\"#eve.on\" class=\"dr-link\"\u003eeve.on\u003c/a\u003e\n\n## eve.version()\nCurrent version of the library.\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadobe-webplatform%2Feve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadobe-webplatform%2Feve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadobe-webplatform%2Feve/lists"}