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

@boost/event

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boost/event - npm Package Compare versions

Comparing version 2.1.1 to 2.2.0

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

## 2.2.0 - 2020-10-09
#### 🚀 Updates
- Return an unlistener from Event#listen. ([0f2a1f8](https://github.com/milesj/boost/commit/0f2a1f8))
**Note:** Version bump only for package @boost/event
### 2.1.1 - 2020-10-08

@@ -8,0 +20,0 @@

10

esm/index.js

@@ -74,2 +74,4 @@ import { createScopedError, createInternalDebugger } from '@boost/internal';

_proto.listen = function listen(listener, scope) {
var _this = this;
if ("production" !== process.env.NODE_ENV) {

@@ -80,3 +82,5 @@ debug('Registering "%s" listener', this.name);

this.getListeners(scope).add(this.validateListener(listener));
return this;
return function () {
_this.unlisten(listener, scope);
};
}

@@ -89,3 +93,3 @@ /**

_proto.once = function once(listener, scope) {
var _this = this;
var _this2 = this;

@@ -95,3 +99,3 @@ var func = this.validateListener(listener);

var handler = function handler() {
_this.unlisten(handler);
_this2.unlisten(handler);

@@ -98,0 +102,0 @@ return func.apply(void 0, arguments);

@@ -1,2 +0,2 @@

import { Listener, WildstarScope } from './types';
import { Listener, Unlistener, WildstarScope } from './types';
export default abstract class BaseEvent<Return, Args extends unknown[], Scope extends string = string> {

@@ -21,7 +21,7 @@ listeners: Map<"*" | Scope, Set<Listener<Args, Return>>>;

*/
listen(listener: Listener<Args, Return>, scope?: Scope): this;
listen(listener: Listener<Args, Return>, scope?: Scope): Unlistener;
/**
* Register a listener to the event that only triggers once.
*/
once(listener: Listener<Args, Return>, scope?: Scope): this;
once(listener: Listener<Args, Return>, scope?: Scope): Unlistener;
/**

@@ -28,0 +28,0 @@ * Remove a listener from the event.

@@ -78,2 +78,4 @@ 'use strict';

_proto.listen = function listen(listener, scope) {
var _this = this;
if ("production" !== process.env.NODE_ENV) {

@@ -84,3 +86,5 @@ debug('Registering "%s" listener', this.name);

this.getListeners(scope).add(this.validateListener(listener));
return this;
return function () {
_this.unlisten(listener, scope);
};
}

@@ -93,3 +97,3 @@ /**

_proto.once = function once(listener, scope) {
var _this = this;
var _this2 = this;

@@ -99,3 +103,3 @@ var func = this.validateListener(listener);

var handler = function handler() {
_this.unlisten(handler);
_this2.unlisten(handler);

@@ -102,0 +106,0 @@ return func.apply(void 0, arguments);

@@ -8,3 +8,4 @@ export declare type Listener<A extends unknown[], R> = A extends [

] ? (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => R : A extends [infer A1, infer A2, infer A3, infer A4] ? (a1: A1, a2: A2, a3: A3, a4: A4) => R : A extends [infer A1, infer A2, infer A3] ? (a1: A1, a2: A2, a3: A3) => R : A extends [infer A1, infer A2] ? (a1: A1, a2: A2) => R : A extends [infer A1] ? (a1: A1) => R : A extends unknown[] ? (...args: A) => R : never;
export declare type Unlistener = () => void;
export declare type WildstarScope = '*';
//# sourceMappingURL=types.d.ts.map
{
"name": "@boost/event",
"version": "2.1.1",
"version": "2.2.0",
"release": "1594765247526",

@@ -30,3 +30,3 @@ "description": "An event system with multiple emitter patterns.",

},
"gitHead": "ae1d2626dae91a712357029bc6d43a78b422ed27"
"gitHead": "396874e92426ba538eace9f17543f1ffee9fb956"
}

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