Comparing version 2.0.0-alpha.8 to 2.0.0-alpha.9
@@ -5,2 +5,9 @@ # Changelog | ||
## [2.0.0-alpha.9](https://github.com/snowyu/events-ex.js/compare/v2.0.0-alpha.8...v2.0.0-alpha.9) (2024-03-26) | ||
### Features | ||
* add type(event) to Event(this) for listener ([42b35e7](https://github.com/snowyu/events-ex.js/commit/42b35e75bf224b79d3b967469a7beb4f5aa120d1)) | ||
## [2.0.0-alpha.8](https://github.com/snowyu/events-ex.js/compare/v2.0.0-alpha.7...v2.0.0-alpha.8) (2024-03-20) | ||
@@ -7,0 +14,0 @@ |
@@ -29,2 +29,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / [event-emitter](../modules/event_emitter-1.md) / EventEmitter | ||
[src/event-emitter.js:7](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event-emitter.js#L7) | ||
[src/event-emitter.js:7](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event-emitter.js#L7) |
@@ -50,3 +50,3 @@ [events-ex](../README.md) / [Exports](../modules.md) / [event-emitter](../modules/event_emitter.md) / EventEmitter | ||
[src/event-emitter.d.ts:7](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event-emitter.d.ts#L7) | ||
[src/event-emitter.d.ts:7](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event-emitter.d.ts#L7) | ||
@@ -76,3 +76,3 @@ ## Methods | ||
[src/event-emitter.d.ts:38](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event-emitter.d.ts#L38) | ||
[src/event-emitter.d.ts:38](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event-emitter.d.ts#L38) | ||
@@ -102,3 +102,3 @@ ___ | ||
[src/event-emitter.d.ts:44](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event-emitter.d.ts#L44) | ||
[src/event-emitter.d.ts:44](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event-emitter.d.ts#L44) | ||
@@ -127,3 +127,3 @@ ___ | ||
[src/event-emitter.d.ts:66](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event-emitter.d.ts#L66) | ||
[src/event-emitter.d.ts:66](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event-emitter.d.ts#L66) | ||
@@ -152,3 +152,3 @@ ___ | ||
[src/event-emitter.d.ts:59](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event-emitter.d.ts#L59) | ||
[src/event-emitter.d.ts:59](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event-emitter.d.ts#L59) | ||
@@ -182,3 +182,3 @@ ___ | ||
[src/event-emitter.d.ts:32](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event-emitter.d.ts#L32) | ||
[src/event-emitter.d.ts:32](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event-emitter.d.ts#L32) | ||
@@ -212,3 +212,3 @@ ___ | ||
[src/event-emitter.d.ts:16](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event-emitter.d.ts#L16) | ||
[src/event-emitter.d.ts:16](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event-emitter.d.ts#L16) | ||
@@ -242,3 +242,3 @@ ___ | ||
[src/event-emitter.d.ts:24](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event-emitter.d.ts#L24) | ||
[src/event-emitter.d.ts:24](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event-emitter.d.ts#L24) | ||
@@ -267,3 +267,3 @@ ___ | ||
[src/event-emitter.d.ts:51](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event-emitter.d.ts#L51) | ||
[src/event-emitter.d.ts:51](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event-emitter.d.ts#L51) | ||
@@ -288,3 +288,3 @@ ___ | ||
[src/event-emitter.d.ts:52](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event-emitter.d.ts#L52) | ||
[src/event-emitter.d.ts:52](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event-emitter.d.ts#L52) | ||
@@ -310,2 +310,2 @@ ___ | ||
[src/event-emitter.d.ts:67](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event-emitter.d.ts#L67) | ||
[src/event-emitter.d.ts:67](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event-emitter.d.ts#L67) |
@@ -18,2 +18,3 @@ [events-ex](../README.md) / [Exports](../modules.md) / [event](../modules/event.md) / Event | ||
- [target](event.Event.md#target) | ||
- [type](event.Event.md#type) | ||
@@ -29,3 +30,3 @@ ### Methods | ||
• **new Event**(`target`): [`Event`](event.Event.md) | ||
• **new Event**(`target`, `type`): [`Event`](event.Event.md) | ||
@@ -39,2 +40,3 @@ Creates a new Event object instance that contains information about the event, such as the target element and the return value of the event. | ||
| `target` | [`EventEmitter`](event_emitter.EventEmitter.md) | Who trigger the event | | ||
| `type` | `any` | - | | ||
@@ -53,3 +55,3 @@ #### Returns | ||
[src/event.js:8](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event.js#L8) | ||
[src/event.js:8](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event.js#L8) | ||
@@ -66,3 +68,3 @@ ## Properties | ||
[src/event.js:38](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event.js#L38) | ||
[src/event.js:38](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event.js#L38) | ||
@@ -79,3 +81,3 @@ ___ | ||
[src/event.js:32](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event.js#L32) | ||
[src/event.js:32](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event.js#L32) | ||
@@ -92,4 +94,14 @@ ___ | ||
[src/event.js:26](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event.js#L26) | ||
[src/event.js:26](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event.js#L26) | ||
___ | ||
### type | ||
• **type**: `any` | ||
#### Defined in | ||
[src/event.js:44](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event.js#L44) | ||
## Methods | ||
@@ -111,3 +123,3 @@ | ||
[src/event.js:45](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event.js#L45) | ||
[src/event.js:51](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event.js#L51) | ||
@@ -118,3 +130,3 @@ ___ | ||
▸ **init**(`target`): `void` | ||
▸ **init**(`target`, `type`): `void` | ||
@@ -128,2 +140,3 @@ Initializes the event with the target object. | ||
| `target` | [`EventEmitter`](event_emitter.EventEmitter.md) | The target object for the event. | | ||
| `type` | `any` | - | | ||
@@ -136,2 +149,2 @@ #### Returns | ||
[src/event.js:20](https://github.com/snowyu/events-ex.js/blob/da3be72/src/event.js#L20) | ||
[src/event.js:20](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/event.js#L20) |
@@ -44,2 +44,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / all-off | ||
[src/all-off.js:12](https://github.com/snowyu/events-ex.js/blob/da3be72/src/all-off.js#L12) | ||
[src/all-off.js:12](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/all-off.js#L12) |
@@ -28,2 +28,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / consts | ||
[src/consts.js:6](https://github.com/snowyu/events-ex.js/blob/da3be72/src/consts.js#L6) | ||
[src/consts.js:6](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/consts.js#L6) |
@@ -51,2 +51,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / default-methods | ||
[src/default-methods.js:8](https://github.com/snowyu/events-ex.js/blob/da3be72/src/default-methods.js#L8) | ||
[src/default-methods.js:8](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/default-methods.js#L8) |
@@ -40,2 +40,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / has-listeners | ||
[src/has-listeners.js:10](https://github.com/snowyu/events-ex.js/blob/da3be72/src/has-listeners.js#L10) | ||
[src/has-listeners.js:10](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/has-listeners.js#L10) |
@@ -49,2 +49,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / pipe-async | ||
[src/pipe-async.js:21](https://github.com/snowyu/events-ex.js/blob/da3be72/src/pipe-async.js#L21) | ||
[src/pipe-async.js:21](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/pipe-async.js#L21) |
@@ -49,2 +49,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / pipe | ||
[src/pipe.js:21](https://github.com/snowyu/events-ex.js/blob/da3be72/src/pipe.js#L21) | ||
[src/pipe.js:21](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/pipe.js#L21) |
@@ -46,2 +46,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / unify | ||
[src/unify.js:17](https://github.com/snowyu/events-ex.js/blob/da3be72/src/unify.js#L17) | ||
[src/unify.js:17](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/unify.js#L17) |
@@ -39,2 +39,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / util/array-remove | ||
[src/util/array-remove.js:5](https://github.com/snowyu/events-ex.js/blob/da3be72/src/util/array-remove.js#L5) | ||
[src/util/array-remove.js:5](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/util/array-remove.js#L5) |
@@ -41,2 +41,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / util/object-for-each | ||
[src/util/object-for-each.js:6](https://github.com/snowyu/events-ex.js/blob/da3be72/src/util/object-for-each.js#L6) | ||
[src/util/object-for-each.js:6](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/util/object-for-each.js#L6) |
@@ -40,2 +40,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / util/string-pad | ||
[src/util/string-pad.js:8](https://github.com/snowyu/events-ex.js/blob/da3be72/src/util/string-pad.js#L8) | ||
[src/util/string-pad.js:8](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/util/string-pad.js#L8) |
@@ -39,2 +39,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / util/to-int | ||
[src/util/to-int.js:2](https://github.com/snowyu/events-ex.js/blob/da3be72/src/util/to-int.js#L2) | ||
[src/util/to-int.js:2](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/util/to-int.js#L2) |
@@ -39,2 +39,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / util/valid-callable | ||
[src/util/valid-callable.js:1](https://github.com/snowyu/events-ex.js/blob/da3be72/src/util/valid-callable.js#L1) | ||
[src/util/valid-callable.js:1](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/util/valid-callable.js#L1) |
@@ -39,2 +39,2 @@ [events-ex](../README.md) / [Exports](../modules.md) / util/valid-object | ||
[src/util/valid-object.js:3](https://github.com/snowyu/events-ex.js/blob/da3be72/src/util/valid-object.js#L3) | ||
[src/util/valid-object.js:3](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/util/valid-object.js#L3) |
@@ -33,3 +33,3 @@ [events-ex](../README.md) / [Exports](../modules.md) / wrap-event-emitter | ||
[src/wrap-event-emitter.js:6](https://github.com/snowyu/events-ex.js/blob/da3be72/src/wrap-event-emitter.js#L6) | ||
[src/wrap-event-emitter.js:6](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/wrap-event-emitter.js#L6) | ||
@@ -58,2 +58,2 @@ ## Functions | ||
[src/wrap-event-emitter.js:33](https://github.com/snowyu/events-ex.js/blob/da3be72/src/wrap-event-emitter.js#L33) | ||
[src/wrap-event-emitter.js:33](https://github.com/snowyu/events-ex.js/blob/42b35e7/src/wrap-event-emitter.js#L33) |
@@ -97,3 +97,3 @@ "use strict"; | ||
const listeners = r.listeners; | ||
const evt = (0, _event.Event)(this); | ||
const evt = (0, _event.Event)(this, r.type); | ||
const errs = []; | ||
@@ -141,3 +141,3 @@ try { | ||
const listeners = r.listeners; | ||
const evt = (0, _event.Event)(this); | ||
const evt = (0, _event.Event)(this, r.type); | ||
const errs = []; | ||
@@ -144,0 +144,0 @@ try { |
@@ -8,3 +8,3 @@ /** | ||
*/ | ||
export function Event(target: import('./event-emitter').EventEmitter): Event; | ||
export function Event(target: import('./event-emitter').EventEmitter, type: any): Event; | ||
export class Event { | ||
@@ -18,3 +18,3 @@ /** | ||
*/ | ||
constructor(target: import('./event-emitter').EventEmitter); | ||
constructor(target: import('./event-emitter').EventEmitter, type: any); | ||
/** | ||
@@ -24,3 +24,3 @@ * Initializes the event with the target object. | ||
*/ | ||
init(target: import('./event-emitter').EventEmitter): void; | ||
init(target: import('./event-emitter').EventEmitter, type: any): void; | ||
/** | ||
@@ -44,2 +44,3 @@ * Who trigger the event | ||
public result: any; | ||
type: any; | ||
/** | ||
@@ -46,0 +47,0 @@ * Ends the event and returns the result. |
@@ -15,8 +15,8 @@ "use strict"; | ||
*/ | ||
function Event(target) { | ||
function Event(target, type) { | ||
if (!(this instanceof Event)) { | ||
const evt = new Event(target); | ||
const evt = new Event(target, type); | ||
return evt; | ||
} | ||
this.init(target); | ||
this.init(target, type); | ||
} | ||
@@ -28,3 +28,3 @@ | ||
*/ | ||
Event.prototype.init = function (target) { | ||
Event.prototype.init = function (target, type) { | ||
/** | ||
@@ -48,2 +48,8 @@ * Who trigger the event | ||
this.result = undefined; | ||
/** | ||
* The type of the event. | ||
* @type {string} | ||
* @public | ||
*/ | ||
if (type) this.type = type; | ||
}; | ||
@@ -50,0 +56,0 @@ |
{ | ||
"name": "events-ex", | ||
"version": "2.0.0-alpha.8", | ||
"version": "2.0.0-alpha.9", | ||
"description": "Browser-friendly enhanced events most compatible with standard node.js, it's powerful eventable ability.", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -94,3 +94,3 @@ import {defineProperty, isArray, isFunction, isNumber, isObject, isUndefined} from 'util-ex' | ||
const listeners = r.listeners | ||
const evt = Event(this) | ||
const evt = Event(this, r.type) | ||
const errs = [] | ||
@@ -131,3 +131,3 @@ try { | ||
const listeners = r.listeners | ||
const evt = Event(this) | ||
const evt = Event(this, r.type) | ||
const errs = [] | ||
@@ -134,0 +134,0 @@ try { |
@@ -8,8 +8,8 @@ /** | ||
*/ | ||
export function Event(target) { | ||
export function Event(target, type) { | ||
if (!(this instanceof Event)) { | ||
const evt = new Event(target) | ||
const evt = new Event(target, type) | ||
return evt | ||
} | ||
this.init(target) | ||
this.init(target, type) | ||
} | ||
@@ -21,3 +21,3 @@ | ||
*/ | ||
Event.prototype.init = function(target) { | ||
Event.prototype.init = function(target, type) { | ||
/** | ||
@@ -41,2 +41,8 @@ * Who trigger the event | ||
this.result = undefined | ||
/** | ||
* The type of the event. | ||
* @type {string} | ||
* @public | ||
*/ | ||
if (type) this.type = type; | ||
} | ||
@@ -43,0 +49,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
138136
2166