Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

emmi

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emmi - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

dist/helpers.cjs

7

dist/index.d.ts

@@ -7,2 +7,7 @@ export type Event<Input, Output> = {

type NonUndefined<T> = T extends undefined | void ? never : T;
/**
* emmi - a small event emitter that enables many workflows
*
* [Github](https://github.com/AndersCan/emmi)
*/
export declare function emmi<EMap extends EventMap>(): {

@@ -13,4 +18,4 @@ on: <Key extends keyof EMap>(key: Key, listener: (args: EMap[Key]["input"]) => EMap[Key]["output"]) => void;

off: <Key_3 extends keyof EMap>(key: Key_3, listener?: ((args: EMap[Key_3]["input"]) => EMap[Key_3]["output"]) | undefined) => void;
offReply: <Key_4 extends keyof EMap>(key: Key_4, listener?: ((input: EMap[Key_4]["input"], output: EMap[Key_4]["output"][]) => void) | undefined) => void;
offReply: <Key_4 extends keyof EMap>(key: Key_4, listener?: ((input: EMap[Key_4]["input"], output: NonUndefined<EMap[Key_4]["output"]>[]) => void) | undefined) => void;
};
export {};

3

dist/index.js

@@ -44,3 +44,4 @@ function emmi() {

if (handlers) {
handlers.splice(handlers.indexOf(listener) >>> 0, 1);
const index = handlers.indexOf(listener);
index !== -1 && handlers.splice(index, 1);
}

@@ -47,0 +48,0 @@ }

{
"name": "emmi",
"version": "0.4.0",
"version": "0.5.0",
"type": "module",

@@ -12,2 +12,6 @@ "main": "./dist/index.cjs",

"require": "./dist/index.cjs"
},
"./helpers": {
"import": "./dist/helpers.js",
"require": "./dist/helpers.cjs"
}

@@ -18,2 +22,3 @@ },

],
"sideEffects": false,
"scripts": {

@@ -20,0 +25,0 @@ "dev": "vite",

@@ -14,1 +14,7 @@ # emmi

Other that that, should be similar to other event emitter libraries.
## Listeners
Listeners can return the `Output` type, or simply omit returning anything. For convenience, listeners that return `undefined`/`void` will not be added to the `Output[]` result of an `emit`.
Note that async functions that return `undefined` (`Promise<undefined>`) **will** be returned

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc