Comparing version 0.3.0 to 0.4.0
'use strict'; | ||
var EventEmitter2 = require('eventemitter2').EventEmitter2; | ||
const eventEmitter2 = require('eventemitter2'); | ||
var draht = {}, | ||
instance; | ||
// There is a bug in the way eventemitter2 exports its content, depending on | ||
// the build context (Node.js, webpack, ...). The details can be found here: | ||
// https://github.com/asyncly/EventEmitter2/issues/146 ... The following line | ||
// acts as a workaround to make things work, no matter what environment you are | ||
// in. | ||
const EventEmitter2 = eventEmitter2.EventEmitter2 || eventEmitter2; | ||
const draht = {}; | ||
draht.create = function () { | ||
var emitter = new EventEmitter2({ | ||
const emitter = new EventEmitter2({ | ||
delimiter: '::', | ||
@@ -15,23 +21,22 @@ wildcard: true | ||
return { | ||
emit: function () { | ||
var args = arguments; | ||
process.nextTick(function () { | ||
emitter.emit.apply(emitter, Array.prototype.slice.call(args)); | ||
emit (...args) { | ||
process.nextTick(() => { | ||
emitter.emit(...args); | ||
}); | ||
}, | ||
on: function () { | ||
emitter.on.apply(emitter, Array.prototype.slice.call(arguments)); | ||
on (...args) { | ||
emitter.on(...args); | ||
}, | ||
once: function () { | ||
emitter.once.apply(emitter, Array.prototype.slice.call(arguments)); | ||
once (...args) { | ||
emitter.once(...args); | ||
}, | ||
removeListener: function () { | ||
emitter.removeListener.apply(emitter, Array.prototype.slice.call(arguments)); | ||
removeListener (...args) { | ||
emitter.removeListener(...args); | ||
}, | ||
removeAllListeners: function () { | ||
emitter.removeAllListeners.apply(emitter, Array.prototype.slice.call(arguments)); | ||
removeAllListeners (...args) { | ||
emitter.removeAllListeners(...args); | ||
} | ||
@@ -41,3 +46,3 @@ }; | ||
instance = draht.create(); | ||
const instance = draht.create(); | ||
@@ -44,0 +49,0 @@ draht.get = function () { |
{ | ||
"name": "draht", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "draht provides process-level messaging.", | ||
@@ -17,8 +17,8 @@ "contributors": [ | ||
"dependencies": { | ||
"eventemitter2": "0.4.14" | ||
"eventemitter2": "3.0.0" | ||
}, | ||
"devDependencies": { | ||
"assertthat": "0.5.1", | ||
"grunt": "0.4.5", | ||
"tourism": "0.14.0" | ||
"assertthat": "0.8.3", | ||
"roboter": "0.14.3", | ||
"roboter-server": "0.14.3" | ||
}, | ||
@@ -29,3 +29,7 @@ "repository": { | ||
}, | ||
"keywords": [ | ||
"eventbus", | ||
"messaging" | ||
], | ||
"license": "MIT" | ||
} |
@@ -9,3 +9,5 @@ # draht | ||
$ npm install draht | ||
```bash | ||
$ npm install draht | ||
``` | ||
@@ -17,3 +19,3 @@ ## Quick start | ||
```javascript | ||
var draht = require('draht'); | ||
const draht = require('draht'); | ||
``` | ||
@@ -26,3 +28,3 @@ | ||
```javascript | ||
var bus = draht.get(); | ||
const bus = draht.get(); | ||
``` | ||
@@ -37,3 +39,3 @@ | ||
```javascript | ||
var bus = draht.create(); | ||
const bus = draht.create(); | ||
``` | ||
@@ -50,3 +52,3 @@ | ||
```javascript | ||
bus.emit('foo', { bar: 'baz' }, function () { | ||
bus.emit('foo', { bar: 'baz' }, () => { | ||
// ... | ||
@@ -61,3 +63,3 @@ }); | ||
```javascript | ||
bus.emit('demo::foo', { bar: 'baz' }, function () { | ||
bus.emit('demo::foo', { bar: 'baz' }, () => { | ||
// ... | ||
@@ -72,3 +74,3 @@ }); | ||
```javascript | ||
bus.on('demo::foo', function (evt, callback) { | ||
bus.on('demo::foo', (evt, callback) => { | ||
// ... | ||
@@ -81,3 +83,3 @@ }); | ||
```javascript | ||
bus.once('demo::foo', function (evt, callback) { | ||
bus.once('demo::foo', (evt, callback) => { | ||
// ... | ||
@@ -90,3 +92,3 @@ }); | ||
```javascript | ||
bus.on('demo::*', function (evt, callback) { | ||
bus.on('demo::*', (evt, callback) => { | ||
// ... | ||
@@ -103,3 +105,3 @@ }); | ||
```javascript | ||
var onFoo = function (evt, callback) { | ||
const onFoo = function (evt, callback) { | ||
// ... | ||
@@ -127,5 +129,7 @@ }; | ||
This module can be built using [Grunt](http://gruntjs.com/). Besides running the tests, this also analyses the code. To run Grunt, go to the folder where you have installed draht and run `grunt`. You need to have [grunt-cli](https://github.com/gruntjs/grunt-cli) installed. | ||
To build this module use [roboter](https://www.npmjs.com/package/roboter). | ||
$ grunt | ||
```bash | ||
$ bot | ||
``` | ||
@@ -135,3 +139,3 @@ ## License | ||
The MIT License (MIT) | ||
Copyright (c) 2013-2015 the native web. | ||
Copyright (c) 2013-2017 the native web. | ||
@@ -138,0 +142,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
104168
9
123
135
1
+ Addedeventemitter2@3.0.0(transitive)
- Removedeventemitter2@0.4.14(transitive)
Updatedeventemitter2@3.0.0