@nichoth/events
Advanced tools
+1
-1
| { | ||
| "name": "@nichoth/events", | ||
| "version": "3.1.3", | ||
| "version": "3.1.4", | ||
| "description": "Event emitter and helpers", | ||
@@ -5,0 +5,0 @@ "directories": { |
+9
-5
@@ -9,7 +9,2 @@ import test from "tape"; | ||
| t.equal(typeof bus.emit, "function", "should have .emit"); | ||
| t.doesNotThrow( | ||
| () => Bus.createEvents({ test: ["test"] }), | ||
| null, | ||
| "prefix parameter is optional" | ||
| ); | ||
| t.end(); | ||
@@ -133,1 +128,10 @@ }); | ||
| }); | ||
| test("star listener", (t) => { | ||
| t.plan(2); | ||
| const bus2 = new Bus(["foo", "bar"]); | ||
| bus2.on("*", function(name, data) { | ||
| t.equal(name, "foo", "should get the event name"); | ||
| t.equal(data, "hello", "should get the event data"); | ||
| }); | ||
| bus2.emit("foo", "hello"); | ||
| }); |
+12
-0
@@ -125,1 +125,13 @@ import test from 'tape' | ||
| }) | ||
| test('star listener', t => { | ||
| t.plan(2) | ||
| const bus = new Bus(['foo', 'bar']) | ||
| bus.on('*', function (name:string, data) { | ||
| t.equal(name, 'foo', 'should get the event name') | ||
| t.equal(data, 'hello', 'should get the event data') | ||
| }) | ||
| bus.emit('foo', 'hello') | ||
| }) |
69375
0.65%760
1.74%