tiny-emitter
Advanced tools
Comparing version 0.1.11 to 0.1.12
function E () { | ||
// Keep this empty so it's easier to inherit from | ||
// Keep this empty so it's easier to inherit from | ||
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) | ||
@@ -7,3 +7,3 @@ } | ||
E.prototype = { | ||
on: function (name, callback, ctx) { | ||
on: function (name, callback, ctx) { | ||
var e = this.e || (this.e = {}); | ||
@@ -31,3 +31,3 @@ | ||
var data = [].slice.call(arguments, 1); | ||
var evtArr = (this.e[name] || []).slice(); | ||
var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); | ||
var i = 0; | ||
@@ -57,2 +57,3 @@ var len = evtArr.length; | ||
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 | ||
(liveEvents.length) | ||
@@ -66,2 +67,2 @@ ? e[name] = liveEvents | ||
module.exports = E; | ||
module.exports = E; |
{ | ||
"name": "tiny-emitter", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "A tiny (less than 1k) event emitter library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -190,2 +190,9 @@ var Emitter = require('../index.js'); | ||
t.end(); | ||
}); | ||
}); | ||
test('emitting event that has not been subscribed to yet', function (t) { | ||
var emitter = new Emitter(); | ||
emitter.emit('some-event', 'some message'); | ||
t.end(); | ||
}); |
13467
288