{"_id":"@aibee/eve","_rev":"3-bc36f543615c6040916479efb697bc74","name":"@aibee/eve","dist-tags":{"latest":"0.5.4"},"versions":{"0.5.4":{"name":"@aibee/eve","version":"0.5.4","author":{"url":"http://dmitry.baranovskiy.com","name":"Dmitry Baranovskiy","email":"dmitry@baranovskiy.com"},"license":"Apache-2.0","_id":"@aibee/eve@0.5.4","maintainers":[{"name":"kxiaoaibee","email":"kxiao@aibee.com"},{"name":"wukang0718","email":"wukang0718@163.com"},{"name":"jyfang","email":"jyfang@aibee.com"},{"name":"hujingn","email":"hujingn@qq.com"}],"dist":{"shasum":"16355ee9f1de245174c5ae601560fd3e26cc1b2f","tarball":"https://registry.npmjs.org/@aibee/eve/-/eve-0.5.4.tgz","fileCount":8,"integrity":"sha512-T3XZpywuMyr7JqYDrZUGCIM7nuZHtts3UxOMUUtmIlzaDjJfxXt+Lk2MW8jchl+pEMP0wtD4BYLqrZLwbm7IRw==","signatures":[{"sig":"MEUCIEOpoIolT7YLPGZp5vOh3Yw78zk6Q331WBvgJVckM0CAAiEAw4ywgkLbhUk8NwSYBwyThVC0jwsH+17Z5pASdbMg6gg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":36326,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjv29pACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrucQ/+P1v5I9T6DSQ4XkUn7JFFcz2FeCmcilhe0dmRVxgyLnD6oq9c\r\n1hc3TKdoXQ8fBUTO6CBqvGaip+dUDqDNudSTRPwJMDlDBKt/18Z+HmPJ0ZQV\r\n0OHzrb/8K74Qfz/iP+fY20t/RxjicBLtyYTh1ioc/OTVvJY23FRykw894Vi5\r\nX9JIyIwTy/26HO7/r25tX8ucbWExKCkKApSal9A2pSkbdKyaQMQdeoKb1OfR\r\n8v9ZuRUBbAvx8DP0FOB/cY6btVIo4WElOWS/YNwEMfCXQRJuf0+f3qdyBzOy\r\nRCbuSQFywPt2sflzvNII8HnEpXhJq6cti3RWG+JoH6qCxPFXWRh8Z00i7bQb\r\nJUkBgQTqukUM+vMabQ+gzXGn6I2el/Pm6zdQrPbhp3r+31RckY6xAl8kpAZL\r\nqNpwV2xDHSMNpQ3xeHH3raBTRUxchj5KA04KUXcW4DjbbdAwn2CbGfCsi3ue\r\nkn5wQGhkAOkB9WeDHVoVrE4eB0c/zrpb93fJqXUizuBVRaUzsuwZjO3pokZw\r\nLfwM4N0SRKaw1D2nTaz6lOnoDElC30uDq56wc/z2Vxh+rUVz0MSAUT4HLjOy\r\nLJYC4BDhcyRvabPTr7TbqMhpQ+xbIXqAkhREDeU0h6uUesPXSfuZ7lE3jM13\r\nVq/aYKBkygHU/JsSFIgedMTWtjugKtIm3gU=\r\n=OXPl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./eve.js","gitHead":"65668e7ab8bacb8a94230c37ae03cbd8b2f2d16f","scripts":{"test":"eslint eve.js","build":"node node_modules/dr.js/dr dr.json"},"_npmUser":{"name":"wukang0718","email":"wukang0718@163.com"},"repository":{"url":"git@code.aibee.cn:jyfang/eve.git","type":"git"},"_npmVersion":"6.14.14","description":"Simple custom events","directories":{},"_nodeVersion":"14.17.4","eslintConfig":{"rules":{"radix":2,"eqeqeq":0,"indent":["error",4,{"SwitchCase":1,"VariableDeclarator":1}],"quotes":[1,"double","avoid-escape"],"strict":0,"new-cap":0,"camelcase":0,"no-shadow":0,"new-parens":0,"comma-dangle":0,"no-loop-func":0,"no-sequences":1,"no-path-concat":0,"no-unused-vars":[2,{"args":"none","vars":"all"}],"no-extra-parens":1,"no-multi-spaces":[0,{"exceptions":{"VariableDeclarator":true}}],"no-new-wrappers":0,"block-scoped-var":0,"no-extend-native":0,"consistent-return":0,"no-mixed-requires":0,"no-trailing-spaces":[2,{"skipBlankLines":false}],"no-underscore-dangle":0,"no-unused-expressions":0,"space-before-function-paren":[2,{"named":"never","anonymous":"always"}]},"globals":{"window":true,"console":true}},"_hasShrinkwrap":false,"devDependencies":{"dr.js":"~0.1.0","mocha":"*","eslint":"*","expect.js":"*"},"_npmOperationalInternal":{"tmp":"tmp/eve_0.5.4_1673490281715_0.3164221643236549","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-01-12T02:24:41.666Z","modified":"2025-07-09T08:57:05.161Z","0.5.4":"2023-01-12T02:24:41.954Z"},"author":{"url":"http://dmitry.baranovskiy.com","name":"Dmitry Baranovskiy","email":"dmitry@baranovskiy.com"},"license":"Apache-2.0","repository":{"url":"git@code.aibee.cn:jyfang/eve.git","type":"git"},"description":"Simple custom events","maintainers":[{"email":"jyfang@aibee.com","name":"jyfang"},{"email":"hujingn@qq.com","name":"hujingn"},{"email":"wukang0718@163.com","name":"wukang0718"},{"email":"kxiao@aibee.com","name":"kxiaoaibee"},{"email":"jdzou@aibee.com","name":"yfdjcxj"},{"email":"j15712551103@163.com","name":"zcjia"}],"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 <a href=\"#eve\" class=\"dr-link\">eve</a> 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 <a href=\"#eve.off\" class=\"dr-link\">eve.off</a>\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 <a href=\"#eve\" class=\"dr-link\">eve</a> 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 <a href=\"#eve.on\" class=\"dr-link\">eve.on</a>\n\n## eve.version()\nCurrent version of the library.\n\n\n","readmeFilename":"README.md"}