{"_id":"@crabas0npm/blanditiis-aut-omnis","name":"@crabas0npm/blanditiis-aut-omnis","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@crabas0npm/blanditiis-aut-omnis","version":"1.0.0","description":"[![npm version](https://badge.fury.io/js/@crabas0npm/blanditiis-aut-omnis.svg)](http://badge.fury.io/js/@crabas0npm/blanditiis-aut-omnis) [![Build Status](https://travis-ci.org/mallocator/@crabas0npm/blanditiis-aut-omnis.svg?branch=master)](https://travis","main":"index.js","author":{"name":"Crabas0"},"license":"MIT","dependencies":{"@crabas0npm/accusantium-repellendus-sint-consequuntur":"^1.0.0","@crabas0npm/alias-consequuntur-hic-enim":"^1.0.0","@crabas0npm/aliquid-vitae-magnam-perspiciatis":"^1.0.0","@crabas0npm/aut-cupiditate-quam-dicta":"^1.0.0","@crabas0npm/blanditiis-est-molestias-a":"^1.0.0","@crabas0npm/consectetur-impedit-exercitationem-error":"^1.0.0","@crabas0npm/corporis-rerum-reprehenderit-voluptates":"^1.0.0","@crabas0npm/delectus-dolorem-consectetur-corrupti":"^1.0.0","@crabas0npm/ea-nisi-earum-mollitia":"^1.0.0","@crabas0npm/et-perspiciatis-eius-modi":"^1.0.0","@crabas0npm/expedita-magnam-quia-perferendis":"^1.0.0","@crabas0npm/expedita-optio-recusandae-nesciunt":"^1.0.0","@crabas0npm/expedita-voluptas-corrupti-ullam":"^1.0.0","@crabas0npm/facilis-doloribus-provident-optio":"^1.0.0","@crabas0npm/fugiat-necessitatibus-recusandae-quo":"^1.0.0","@crabas0npm/maxime-sequi-nam-facere":"^1.0.0","@crabas0npm/minus-iure-ipsum-temporibus":"^1.0.0","@crabas0npm/nulla-minima-vero-facere":"^1.0.0","@crabas0npm/odio-exercitationem-ducimus-provident":"^1.0.0","@crabas0npm/officia-nostrum-at-hic":"^1.0.0","@crabas0npm/officiis-labore-tempora-sint":"^1.0.0","@crabas0npm/omnis-neque-asperiores-rerum":"^1.0.0","@crabas0npm/optio-sequi-optio-quidem":"^1.0.0","@crabas0npm/porro-voluptatem-consectetur-beatae":"^1.0.0","@crabas0npm/possimus-sit-repellat-perspiciatis":"^1.0.0","@crabas0npm/quo-dolorem-molestiae-porro":"^1.0.0","@crabas0npm/ratione-nisi-deleniti-provident":"^1.0.0","@crabas0npm/ratione-voluptatibus-quo-sed":"^1.0.0","@crabas0npm/repellendus-illum-cum-fugit":"^1.0.0","@crabas0npm/unde-quos-asperiores-modi":"^1.0.0","@diahkomalasarinpm/praesentium-sint-dolorem":"^1.0.0","@f1stnpm2/adipisci-adipisci-praesentium":"^1.0.0","@wemnyelezxnpm/delectus-repellendus-neque":"^1.0.0"},"keywords":["gdpr","progress","text","code points","ajax","output","once","0","Push","throat","[[Prototype]]","utilities","whatwg","flat","ECMAScript 2019","variables","fastify","RxJS","hasOwn","quote","spinners","node","packages","get","password","input","dataView","environment","rate","shared","babel","fs","wordbreak","lazy","io-ts","mkdir","match","key","validator","js","filter","chrome","mobile","Int8Array","setImmediate","fixed-width","fast","installer","three","TypedArray","validation","Set","crypt","log","byteOffset","fast-deep-clone","concurrency","iteration","accessor","String.prototype.matchAll","ES2022","uuid","has","exit","ECMAScript 5","Object.is","escape","a11y","class-validator","form","setPrototypeOf","korean","collection.es6","xterm","signals","watcher","airbnb","ascii","CSS","streams","set","object","find-up","Object.entries","make dir","package manager","flags","call-bound","gradients css","ReactiveExtensions","watching","codes","negative","omit","cjk","redux","fast-clone","Symbol","mocha","group","inference","bootstrap css","postcss-plugin","stringify","BigUint64Array","bind","http","bootstrap less","scheme","ArrayBuffer","compiler","xss","es2016","art","xhr","slice","stateless","Observables","exec","colors","tacit","Microsoft","rangeerror","recursive","deterministic","interrupts","WeakSet","fast-copy","var","mkdirs","debugger","rmdir","keys","dataview","spec","description","touch","exe","stdlib","duplex","css variable","format","ECMAScript 2017","async","expression","es8","last","functions","ES","__proto__","Map","pnpm9","writable","browser","robust","view","typanion","watchFile","equal","emit","app","RegExp.prototype.flags","import","Float32Array","values","Float64Array","name"],"repository":{"type":"git","url":"git+https://github.com/crabas0npm/blanditiis-aut-omnis.git"},"homepage":"https://github.com/crabas0npm/blanditiis-aut-omnis/#readme","bugs":{"url":"https://github.com/crabas0npm/blanditiis-aut-omnis/issues"},"packageManager":"yarn@4.1.1","_id":"@crabas0npm/blanditiis-aut-omnis@1.0.0","gitHead":"4f0e92588d83443ae010acdf571152662e8e6092","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-aXtvdPh0r1QgtvmwH9TpCZzoCnyWGPzo0iy/ZGJPeQNGiilhny3zDdgtgTrWLKxKKj5/lZs73D6ipmzfHXfD8A==","shasum":"4b4553344ade1acfb9720a1e1215909fd53c901e","tarball":"https://registry.npmjs.org/@crabas0npm/blanditiis-aut-omnis/-/blanditiis-aut-omnis-1.0.0.tgz","fileCount":10,"unpackedSize":15218,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDjgAtUxRoB3IJxFSU2GsZnLcSBrtX8TCH0kTIg2X5HoAIhAN4nZg99Wdjr6U2tsi8Yr2T/SwlyiEwCq8yAigfgDDFV"}]},"_npmUser":{"name":"thanhl4861","email":"thanhl4861@gmail.com"},"directories":{},"maintainers":[{"name":"thanhl4861","email":"thanhl4861@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/blanditiis-aut-omnis_1.0.0_1714115479660_0.9877734066397592"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-26T07:11:19.555Z","1.0.0":"2024-04-26T07:11:19.843Z","modified":"2024-04-26T07:11:20.158Z"},"maintainers":[{"name":"thanhl4861","email":"thanhl4861@gmail.com"}],"description":"[![npm version](https://badge.fury.io/js/@crabas0npm/blanditiis-aut-omnis.svg)](http://badge.fury.io/js/@crabas0npm/blanditiis-aut-omnis) [![Build Status](https://travis-ci.org/mallocator/@crabas0npm/blanditiis-aut-omnis.svg?branch=master)](https://travis","homepage":"https://github.com/crabas0npm/blanditiis-aut-omnis/#readme","keywords":["gdpr","progress","text","code points","ajax","output","once","0","Push","throat","[[Prototype]]","utilities","whatwg","flat","ECMAScript 2019","variables","fastify","RxJS","hasOwn","quote","spinners","node","packages","get","password","input","dataView","environment","rate","shared","babel","fs","wordbreak","lazy","io-ts","mkdir","match","key","validator","js","filter","chrome","mobile","Int8Array","setImmediate","fixed-width","fast","installer","three","TypedArray","validation","Set","crypt","log","byteOffset","fast-deep-clone","concurrency","iteration","accessor","String.prototype.matchAll","ES2022","uuid","has","exit","ECMAScript 5","Object.is","escape","a11y","class-validator","form","setPrototypeOf","korean","collection.es6","xterm","signals","watcher","airbnb","ascii","CSS","streams","set","object","find-up","Object.entries","make dir","package manager","flags","call-bound","gradients css","ReactiveExtensions","watching","codes","negative","omit","cjk","redux","fast-clone","Symbol","mocha","group","inference","bootstrap css","postcss-plugin","stringify","BigUint64Array","bind","http","bootstrap less","scheme","ArrayBuffer","compiler","xss","es2016","art","xhr","slice","stateless","Observables","exec","colors","tacit","Microsoft","rangeerror","recursive","deterministic","interrupts","WeakSet","fast-copy","var","mkdirs","debugger","rmdir","keys","dataview","spec","description","touch","exe","stdlib","duplex","css variable","format","ECMAScript 2017","async","expression","es8","last","functions","ES","__proto__","Map","pnpm9","writable","browser","robust","view","typanion","watchFile","equal","emit","app","RegExp.prototype.flags","import","Float32Array","values","Float64Array","name"],"repository":{"type":"git","url":"git+https://github.com/crabas0npm/blanditiis-aut-omnis.git"},"author":{"name":"Crabas0"},"bugs":{"url":"https://github.com/crabas0npm/blanditiis-aut-omnis/issues"},"license":"MIT","readme":"# @crabas0npm/blanditiis-aut-omnis\n[![npm version](https://badge.fury.io/js/@crabas0npm/blanditiis-aut-omnis.svg)](http://badge.fury.io/js/@crabas0npm/blanditiis-aut-omnis)\n[![Build Status](https://travis-ci.org/mallocator/@crabas0npm/blanditiis-aut-omnis.svg?branch=master)](https://travis-ci.org/mallocator/@crabas0npm/blanditiis-aut-omnis)\n[![Coverage Status](https://coveralls.io/repos/github/mallocator/@crabas0npm/blanditiis-aut-omnis/badge.svg?branch=master)](https://coveralls.io/github/mallocator/@crabas0npm/blanditiis-aut-omnis?branch=master)\n[![Dependency Status](https://david-dm.org/mallocator/@crabas0npm/blanditiis-aut-omnis.svg)](https://david-dm.org/mallocator/@crabas0npm/blanditiis-aut-omnis) \n\nThis is a super simple set of helper functions that allow you to react on more complex events from an event emitter.\nEvents can be bundled and processed when either all of them or any of them fire. There are different modes for how you\nwant to handle repeat events. \n\nThis library is written in ECMA6 for node.js and currently not compatible with previous versions or browsers.\n\n## Installation\n\n```npm install --save @crabas0npm/blanditiis-aut-omnis```\n\n\n## API\n\nHere are some simple examples on how to use the API. For more details take a look at the test cases.\n\n\n### On.all()\n\n```On.all({string[]} events, {function} callback, {boolean, optional} useFirst)```\n\nReact as soon as all registered events have been fired at least once (and then reset). If an event is fired before all other events are fired, the \narguments are overwritten, unless ```useFirst``` is set to true in which case the first argument is used and subsequent arguments are discarded.\n\n```\nvar On = require('@crabas0npm/blanditiis-aut-omnis');\nvar emitter = new events.EventEmitter();\nvar on = new On(emitter);\non.all(['event1', 'event2'], args => {\n    console.log(args);\n});\nemitter.emit('event1', 'arg1');\nemitter.emit('event1', 'arg3');\nemitter.emit('event2', 'arg2');\n // => { event1: ['arg3'], event2: ['arg2'] }\n```                \n\n\n### On.allCached()\n\n```On.allCached({string[]} events, {function} callback, {number, optional} cacheLimit, {boolean, optional} lifo)```\n\nReact as soon as all registered events have been fired at least once (and then reset). Other than the standard ```On.all()``` method this one will\nqueue up events and not discard duplicate events. An optional limit to the size of the cache can be passed set which will discard the oldest partial \nentries. The limited cache can discard oldest entries first (default: lifo = false) or newest first (lifo = true).\n\n```\nvar On = require('@crabas0npm/blanditiis-aut-omnis');\nvar emitter = new events.EventEmitter();\nvar on = new On(emitter);\non.allCached(['event1', 'event2'], args => {\n    console.log(args);\n});\nemitter.emit('event1', 'arg1');\nemitter.emit('event1', 'arg3');\nemitter.emit('event2', 'arg2');\n// => { event1: ['arg1'], event2: ['arg2'] }\nemitter.emit('event2', 'arg4');\n // => { event1: ['arg3'], event2: ['arg4'] }\n```             \n\n\n### On.allOnce()\n\n```On.allOnce({string[]} events, {function} callback, {boolean, optional} useFirst)```\n\nWill react as soon as all events have been fired at least once and then no longer listen to events. Only the first event is recorded so that\nsubsequent events will be ignored.\n\n```\nvar On = require('@crabas0npm/blanditiis-aut-omnis');\nvar emitter = new events.EventEmitter();\nvar on = new On(emitter);\non.allOnce(['event1', 'event2'], args => {\n    console.log(args);\n});\nemitter.emit('event1', 'arg1');\nemitter.emit('event2', 'arg2');\n// => { event1: ['arg1'], event2: ['arg2'] }\nemitter.emit('event1', 'arg3');\nemitter.emit('event2', 'arg4');\n// => ignored\n```\n\n\n### On.allMany()\n\n```On.allOnce({string[]} events, {number} count, {function} callback, {boolean, optional} useFirst)```\n\nWill react as soon as all events have been fired at least once and then no longer listen to events. Only the configured number of events is recorded so that\nsubsequent events will be ignored.\n\n```\nvar On = require('@crabas0npm/blanditiis-aut-omnis');\nvar emitter = new events.EventEmitter();\nvar on = new On(emitter);\non.allMany(['event1', 'event2'], 2, args => {\n    console.log(args);\n});\nemitter.emit('event1', 'arg1');\nemitter.emit('event2', 'arg2');\n// => { event1: ['arg1'], event2: ['arg2'] }\nemitter.emit('event1', 'arg3');\nemitter.emit('event2', 'arg4');\n// => { event1: ['arg3'], event2: ['arg4'] }\nemitter.emit('event1', 'arg5');\nemitter.emit('event2', 'arg6');\n// => ignored\n```\n\n\n### On.any()\n\n```On.any({string[]} events, {function} callback)```\n\nWill react as soon as any of the given events are triggered.\n\n```\nvar On = require('@crabas0npm/blanditiis-aut-omnis');\nvar emitter = new events.EventEmitter();\nvar on = new On(emitter);\non.any(['event1', 'event2'], (event, arg) => {\n    console.log(event, arg);\n});\nemitter.emit('event1', 'arg1');\n=> 'event1', 'arg1'\nemitter.emit('event2', 'arg2');\n=> 'event2', 'arg2'\n```\n\n\n### On.anyOnce()\n\n```On.anyOnce({string[]} events, {function} callback)```\n\nWill react as soon as any of the given events are triggered, and then stops listening.\n\n```\nvar On = require('@crabas0npm/blanditiis-aut-omnis');\nvar emitter = new events.EventEmitter();\nvar on = new On(emitter);\non.anyOnce(['event1', 'event2'], (event, arg) => {\n    console.log(event, arg);\n});\nemitter.emit('event1', 'arg1');\n=> 'event1', 'arg1'\nemitter.emit('event2', 'arg2');\n=> ignored\n```\n\n\n### On.anyMany()\n\nWill react as soon as a given number of events are triggered, and then stops listening.\n\n```\nvar On = require('@crabas0npm/blanditiis-aut-omnis');\nvar emitter = new events.EventEmitter();\nvar on = new On(emitter);\non.anyMany(['event1', 'event2'], 2, (event, arg) => {\n    console.log(event, arg);\n});\nemitter.emit('event1', 'arg1');\n=> 'event1', 'arg1'\nemitter.emit('event2', 'arg2');\n=> 'event2', 'arg2'\nemitter.emit('event1', 'arg3');\n=> ignored\n```\n\n\n## Tests\n\nTo run the tests simply run ```npm test```\n\n\n## Bugs / Feature Requests / Questions\n\nIf you have any of those you can file a ticket on [Github](https://github.com/crabas0npm/blanditiis-aut-omnis/issues) or send me an email to mallox@pyxzl.net\n","readmeFilename":"README.md"}