Socket
Socket
Sign inDemoInstall

@effection/events

Package Overview
Dependencies
Maintainers
1
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effection/events - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

6

CHANGELOG.md
# Changelog
## \[2.0.5]
### Dependencies
- Updated to latest `@effection/core`
## \[2.0.4]

@@ -4,0 +10,0 @@

2

dist-cjs/event-source.d.ts

@@ -11,3 +11,3 @@ /// <reference types="node" />

*/
export declare type EventSource = EventEmitterSource | EventTargetSource;
export type EventSource = EventEmitterSource | EventTargetSource;
export declare function addListener<TArgs extends unknown[] = [unknown]>(source: EventSource, name: string, listener: (...args: TArgs) => void): void;

@@ -14,0 +14,0 @@ export declare function removeListener<TArgs extends unknown[] = [unknown]>(source: EventSource, name: string, listener: (...args: TArgs) => void): void;

@@ -45,4 +45,4 @@ "use strict";

function on(source, name, streamName = `on('${name}')`) {
return stream_1.createStream((publish) => core_1.withLabels(function* () {
event_source_1.addListener(source, name, publish);
return (0, stream_1.createStream)((publish) => (0, core_1.withLabels)(function* () {
(0, event_source_1.addListener)(source, name, publish);
try {

@@ -52,3 +52,3 @@ yield;

finally {
event_source_1.removeListener(source, name, publish);
(0, event_source_1.removeListener)(source, name, publish);
}

@@ -90,5 +90,5 @@ }, { name: 'listen', eventName: name, source: source.toString() }), streamName);

function onEmit(source, name, streamName = `onEmit('${name}')`) {
return stream_1.createStream((publish) => core_1.withLabels(function* () {
return (0, stream_1.createStream)((publish) => (0, core_1.withLabels)(function* () {
let listener = (...args) => publish(args);
event_source_1.addListener(source, name, listener);
(0, event_source_1.addListener)(source, name, listener);
try {

@@ -98,3 +98,3 @@ yield;

finally {
event_source_1.removeListener(source, name, listener);
(0, event_source_1.removeListener)(source, name, listener);
}

@@ -101,0 +101,0 @@ }, { name: 'listen', eventName: name, source: source.toString() }), streamName);

@@ -33,7 +33,7 @@ "use strict";

function once(source, eventName) {
return core_1.withLabels((task) => {
let { future, resolve } = core_1.createFuture();
return (0, core_1.withLabels)((task) => {
let { future, resolve } = (0, core_1.createFuture)();
let listener = (...args) => { resolve(args[0]); };
event_source_1.addListener(source, eventName, listener);
task.consume(() => event_source_1.removeListener(source, eventName, listener));
(0, event_source_1.addListener)(source, eventName, listener);
task.consume(() => (0, event_source_1.removeListener)(source, eventName, listener));
return future;

@@ -71,7 +71,7 @@ }, { name: `once`, eventName, source: source.toString() });

function onceEmit(source, eventName) {
return core_1.withLabels((task) => {
let { future, resolve } = core_1.createFuture();
return (0, core_1.withLabels)((task) => {
let { future, resolve } = (0, core_1.createFuture)();
let listener = (...args) => { resolve(args); };
event_source_1.addListener(source, eventName, listener);
task.consume(() => event_source_1.removeListener(source, eventName, listener));
(0, event_source_1.addListener)(source, eventName, listener);
task.consume(() => (0, event_source_1.removeListener)(source, eventName, listener));
return future;

@@ -78,0 +78,0 @@ }, { name: `onceEmit`, eventName, source: source.toString() });

@@ -27,3 +27,3 @@ "use strict";

function* throwOnErrorEvent(source) {
let error = yield once_1.once(source, 'error');
let error = yield (0, once_1.once)(source, 'error');
throw error;

@@ -30,0 +30,0 @@ }

@@ -11,3 +11,3 @@ /// <reference types="node" />

*/
export declare type EventSource = EventEmitterSource | EventTargetSource;
export type EventSource = EventEmitterSource | EventTargetSource;
export declare function addListener<TArgs extends unknown[] = [unknown]>(source: EventSource, name: string, listener: (...args: TArgs) => void): void;

@@ -14,0 +14,0 @@ export declare function removeListener<TArgs extends unknown[] = [unknown]>(source: EventSource, name: string, listener: (...args: TArgs) => void): void;

{
"name": "@effection/events",
"version": "2.0.4",
"version": "2.0.5",
"description": "Helpers for listening to events with effection",

@@ -31,13 +31,5 @@ "main": "dist-cjs/index.js",

"dependencies": {
"@effection/core": "2.2.1",
"@effection/stream": "2.0.4"
"@effection/core": "2.2.2",
"@effection/stream": "2.0.5"
},
"devDependencies": {
"@frontside/tsconfig": "^1.2.0",
"@types/node": "16.3.2",
"expect": "^25.4.0",
"mocha": "^8.3.1",
"ts-node": "^10.4.0",
"typescript": "4.3.5"
},
"volta": {

@@ -44,0 +36,0 @@ "extends": "../../package.json"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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