@braintree/event-emitter
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -0,12 +1,16 @@ | ||
# 0.4.0 | ||
- Add typescript types | ||
# 0.3.0 | ||
* Fix issue where `off` would throw an error if no events existed for named event | ||
* Add `hasListener` method | ||
- Fix issue where `off` would throw an error if no events existed for named event | ||
- Add `hasListener` method | ||
# 0.2.0 | ||
* Add `off` method | ||
- Add `off` method | ||
# 0.1.0 | ||
* Initial release | ||
- Initial release |
{ | ||
"name": "@braintree/event-emitter", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "A simple event emitter.", | ||
"main": "event-emitter.js", | ||
"main": "dist/event-emitter.js", | ||
"types": "dist/event-emitter.d.ts", | ||
"files": [ | ||
@@ -10,5 +11,8 @@ "event-emitter.js" | ||
"scripts": { | ||
"lint": "eslint .", | ||
"pretest": "npm run lint", | ||
"test": "karma start karma.conf.js" | ||
"prepublishOnly": "npm run build", | ||
"prebuild": "prettier --write .", | ||
"build": "tsc --declaration", | ||
"lint": "eslint --ext js,ts .", | ||
"posttest": "npm run lint", | ||
"test": "jest" | ||
}, | ||
@@ -27,19 +31,13 @@ "repository": { | ||
"devDependencies": { | ||
"browserify": "^16.5.0", | ||
"chai": "^4.2.0", | ||
"es6-shim": "^0.35.5", | ||
"eslint": "^6.2.2", | ||
"eslint-config-braintree": "^4.0.0", | ||
"karma": "^4.3.0", | ||
"karma-browserify": "^6.1.0", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-mocha-reporter": "^2.2.5", | ||
"karma-phantomjs-launcher": "^1.0.4", | ||
"mocha": "^6.2.0", | ||
"puppeteer": "^1.19.0", | ||
"sinon": "^7.4.1", | ||
"watchify": "^3.11.1" | ||
"@types/jest": "^26.0.4", | ||
"eslint": "^7.4.0", | ||
"eslint-config-braintree": "^5.0.0-typescript-prep-rc.17", | ||
"jest": "^26.1.0", | ||
"prettier": "^2.0.5", | ||
"ts-jest": "^26.1.2", | ||
"typescript": "^3.9.6" | ||
}, | ||
"jest": { | ||
"preset": "ts-jest" | ||
} | ||
} |
@@ -20,5 +20,5 @@ # event-emitter | ||
```js | ||
var EventEmitter = require('@braintree/event-emitter'); | ||
var EventEmitter = require("@braintree/event-emitter"); | ||
function MyClass () { | ||
function MyClass() { | ||
EventEmitter.call(this); | ||
@@ -30,3 +30,3 @@ } | ||
### Listen for events | ||
### Listen for events | ||
@@ -36,10 +36,10 @@ ```js | ||
obj.on('event-name', function (data) { | ||
console.log('called with', data.payload, '!'); | ||
obj.on("event-name", function (data) { | ||
console.log("called with", data.payload, "!"); | ||
}); | ||
obj._emit('event-name', {payload: 'foo'}); // logs "called with foo!" | ||
obj._emit("event-name", { payload: "foo" }); // logs "called with foo!" | ||
``` | ||
### Unsubscribe from events | ||
### Unsubscribe from events | ||
@@ -50,6 +50,6 @@ ```js | ||
obj.on('event-name', cb); | ||
obj.off('event-name', cb); | ||
obj.on("event-name", cb); | ||
obj.off("event-name", cb); | ||
obj._emit('event-name', {payload: 'foo'}); // cb is not called | ||
obj._emit("event-name", { payload: "foo" }); // cb is not called | ||
``` | ||
@@ -56,0 +56,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
4898
7
49