@for-fun/event-emitter
Advanced tools
Comparing version 0.1.3 to 0.1.4
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function getSet(ee, key) { | ||
@@ -12,3 +10,2 @@ var set = ee.get(key); | ||
} | ||
var errorEvent = Symbol('error'); | ||
@@ -22,3 +19,2 @@ function create() { | ||
} | ||
(ee.get(key) || []).forEach(function (h) { | ||
@@ -25,0 +21,0 @@ return h.apply(void 0, args); |
@@ -8,3 +8,2 @@ function getSet(ee, key) { | ||
} | ||
var errorEvent = Symbol('error'); | ||
@@ -18,3 +17,2 @@ function create() { | ||
} | ||
(ee.get(key) || []).forEach(function (h) { | ||
@@ -21,0 +19,0 @@ return h.apply(void 0, args); |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['@for-fun/event-emitter'] = {})); | ||
}(this, (function (exports) { 'use strict'; | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@for-fun/event-emitter"] = {})); | ||
})(this, (function (exports) { 'use strict'; | ||
@@ -14,3 +14,2 @@ function getSet(ee, key) { | ||
} | ||
var errorEvent = Symbol('error'); | ||
@@ -24,3 +23,2 @@ function create() { | ||
} | ||
(ee.get(key) || []).forEach(function (h) { | ||
@@ -86,5 +84,3 @@ return h.apply(void 0, args); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
})); | ||
//# sourceMappingURL=event-emitter.umd.js.map |
/*! | ||
* @for-fun/event-emitter v0.1.3 (https://github.com/wmzy/event-emitter) | ||
* @for-fun/event-emitter v0.1.4 (https://github.com/wmzy/event-emitter) | ||
* Copyright (c) 2019-present wmzy | ||
* Licensed under MIT (https://github.com/wmzy/event-emitter/blob/master/LICENSE) | ||
*/ | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self)["@for-fun/event-emitter"]={})}(this,(function(n){"use strict";var e=Symbol("error");function r(){return new Map}function t(n,e){for(var r=arguments.length,t=new Array(r>2?r-2:0),o=2;o<r;o++)t[o-2]=arguments[o];(n.get(e)||[]).forEach((function(n){return n.apply(void 0,t)}))}function o(n,r){var t=n.get(e);if(!t||!t.size)throw r;t.forEach((function(n){return n(r)}))}function i(n,e,r){var t=function(n,e){var r=n.get(e);if(r)return r;var t=new Set;return n.set(e,t),t}(n,e);return t.add(r),function(){return t.delete(r)}}function u(n,r){return i(n,e,r)}function f(n,e,r){var t=i(n,e,(function(){t(),r.apply(void 0,arguments)}));return t}function c(n,r){return f(n,e,r)}function a(n){return function(e){return e.bind(null,n)}}n.bindContext=a,n.create=r,n.createAndBind=function(){var n=a(r());return{emit:n(t),emitError:n(o),on:n(i),onError:n(u),once:n(f),onceError:n(c)}},n.emit=t,n.emitError=o,n.errorEvent=e,n.on=i,n.onError=u,n.once=f,n.onceError=c,Object.defineProperty(n,"__esModule",{value:!0})})); | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((n="undefined"!=typeof globalThis?globalThis:n||self)["@for-fun/event-emitter"]={})}(this,(function(n){"use strict";var r=Symbol("error");function e(){return new Map}function t(n,r){for(var e=arguments.length,t=new Array(e>2?e-2:0),o=2;o<e;o++)t[o-2]=arguments[o];(n.get(r)||[]).forEach((function(n){return n.apply(void 0,t)}))}function o(n,e){var t=n.get(r);if(!t||!t.size)throw e;t.forEach((function(n){return n(e)}))}function i(n,r,e){var t=function(n,r){var e=n.get(r);if(e)return e;var t=new Set;return n.set(r,t),t}(n,r);return t.add(e),function(){return t.delete(e)}}function u(n,e){return i(n,r,e)}function f(n,r,e){var t=i(n,r,(function(){t(),e.apply(void 0,arguments)}));return t}function c(n,e){return f(n,r,e)}function a(n){return function(r){return r.bind(null,n)}}n.bindContext=a,n.create=e,n.createAndBind=function(){var n=a(e());return{emit:n(t),emitError:n(o),on:n(i),onError:n(u),once:n(f),onceError:n(c)}},n.emit=t,n.emitError=o,n.errorEvent=r,n.on=i,n.onError=u,n.once=f,n.onceError=c})); | ||
//# sourceMappingURL=event-emitter.umd.min.js.map |
@@ -23,13 +23,13 @@ export const errorEvent: symbol; | ||
export type Handler<P extends any[]> = (...args: P) => void; | ||
export type ErrorHandler = (err: Error) => void; | ||
export type Handler<P extends any[]> = (...args: P) => any; | ||
export type ErrorHandler = (err: Error) => any; | ||
export type OffFunction = () => void; | ||
export function create<T extends ET>(): EventEmitter<T>; | ||
export function emit<E extends EventEmitter<ET>, K extends keyof E[S]>(ee: E, key: K, ...args: E[S][K]): void; | ||
export function emitError(ee: EventEmitter<ET>, err: Error): void; | ||
export function on<E extends EventEmitter<ET>, K extends keyof E[S]>(ee: E, key: K, handler: Handler<E[S][K]>): OffFunction; | ||
export function onError(ee: EventEmitter<ET>, handler: ErrorHandler): OffFunction; | ||
export function once<E extends EventEmitter<ET>, K extends keyof E[S]>(ee: E, key: K, handler: Handler<E[S][K]>): OffFunction; | ||
export function onceError(ee: EventEmitter<ET>, handler: ErrorHandler): OffFunction; | ||
export function emit<E extends EventEmitter<any>, K extends keyof E[S]>(ee: E, key: K, ...args: E[S][K]): void; | ||
export function emitError(ee: EventEmitter<any>, err: Error): void; | ||
export function on<E extends EventEmitter<any>, K extends keyof E[S]>(ee: E, key: K, handler: Handler<E[S][K]>): OffFunction; | ||
export function onError(ee: EventEmitter<any>, handler: ErrorHandler): OffFunction; | ||
export function once<E extends EventEmitter<any>, K extends keyof E[S]>(ee: E, key: K, handler: Handler<E[S][K]>): OffFunction; | ||
export function onceError(ee: EventEmitter<any>, handler: ErrorHandler): OffFunction; | ||
@@ -36,0 +36,0 @@ export function bindContext(context: any): (func: Function) => Function; |
{ | ||
"name": "@for-fun/event-emitter", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "event-emitter", | ||
@@ -19,6 +19,6 @@ "main": "dist/event-emitter.cjs.js", | ||
"build": "rollup -c", | ||
"prepublishOnly": "rimraf dist && npm run build", | ||
"prepublishOnly": "npm test && rimraf dist && npm run build", | ||
"coverage": "nyc report --reporter=text-lcov | coveralls", | ||
"lint": "eslint --fix src test *.js", | ||
"test": "cross-env NODE_ENV=test nyc mocha -r @babel/register --recursive --exclude mock --exclude fixtures -r should -r should-sinon", | ||
"test": "tsc && cross-env NODE_ENV=test nyc mocha -r @babel/register --recursive --exclude mock --exclude *.ts --exclude fixtures -r should -r should-sinon", | ||
"start": "npm test -- --watch" | ||
@@ -40,29 +40,30 @@ }, | ||
"devDependencies": { | ||
"@babel/core": "^7.10.5", | ||
"@babel/preset-env": "^7.10.4", | ||
"@babel/register": "^7.10.5", | ||
"babel-eslint": "^10.1.0", | ||
"commitizen": "^4.1.2", | ||
"coveralls": "^3.1.0", | ||
"cross-env": "^7.0.2", | ||
"cz-conventional-changelog": "^3.2.0", | ||
"eslint": "^7.5.0", | ||
"eslint-config-airbnb-base": "^14.2.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-compat": "^3.8.0", | ||
"eslint-plugin-import": "^2.22.0", | ||
"eslint-plugin-mocha": "^7.0.1", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"husky": "^4.2.5", | ||
"lint-staged": "^10.2.11", | ||
"mocha": "^8.0.1", | ||
"@babel/core": "^7.20.5", | ||
"@babel/eslint-parser": "^7.19.1", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/register": "^7.18.9", | ||
"@rollup/plugin-babel": "^6.0.3", | ||
"@rollup/plugin-terser": "^0.2.0", | ||
"commitizen": "^4.2.6", | ||
"coveralls": "^3.1.1", | ||
"cross-env": "^7.0.3", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^8.29.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-compat": "^4.0.2", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-mocha": "^10.1.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"husky": "^8.0.2", | ||
"lint-staged": "^13.1.0", | ||
"mocha": "^10.1.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.0.5", | ||
"prettier": "^2.8.1", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.23.0", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-terser": "^6.1.0", | ||
"rollup": "^3.6.0", | ||
"should": "^13.2.3", | ||
"should-sinon": "0.0.6", | ||
"sinon": "^9.0.2" | ||
"sinon": "^15.0.0", | ||
"typescript": "^4.9.4" | ||
}, | ||
@@ -69,0 +70,0 @@ "lint-staged": { |
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
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
25374
28
266