Comparing version 0.9.7 to 0.9.8
@@ -348,3 +348,3 @@ // Generated by CoffeeScript 1.9.0 | ||
aClass = Eventable; | ||
} else if (!aClass.hasOwnProperty('defaultMaxListeners')) { | ||
} else if (!aClass.prototype.emit) { | ||
if ((aOptions == null) || !(aOptions.include || aOptions.exclude)) { | ||
@@ -362,3 +362,3 @@ extend(aClass, Eventable); | ||
} | ||
vIncludes.push('defaultMaxListeners'); | ||
vIncludes.push('emit'); | ||
vExcludes = aOptions.exclude; | ||
@@ -365,0 +365,0 @@ if (vExcludes) { |
{ | ||
"name": "events-ex", | ||
"version": "0.9.7", | ||
"version": "0.9.8", | ||
"description": "Browser-friendly enhanced events most compatible with standard node.js, it's powerful eventable ability.", | ||
@@ -5,0 +5,0 @@ "contributors": [ |
@@ -121,3 +121,3 @@ ### events-ex [![Build Status](https://img.shields.io/travis/snowyu/events-ex.js/master.png)](http://travis-ci.org/snowyu/events-ex.js) [![npm](https://img.shields.io/npm/v/events-ex.svg)](https://npmjs.org/package/events-ex) [![downloads](https://img.shields.io/npm/dm/events-ex.svg)](https://npmjs.org/package/events-ex) [![license](https://img.shields.io/npm/l/events-ex.svg)](https://npmjs.org/package/events-ex) | ||
**Note**: the `defaultMaxListeners` is always added to the class. | ||
**Note**: the `emit` is always added to the class. | ||
@@ -124,0 +124,0 @@ ```coffee |
'use strict'; | ||
var inherits = require('util-ex').inherits; | ||
//t=Eventable; a=assert | ||
@@ -15,5 +17,5 @@ module.exports = function (eventable, assert) { | ||
var keys = Object.keys(My); | ||
assert.deepEqual(keys, ['defaultMaxListeners', 'listenerCount']); | ||
assert.deepEqual(keys, ['listenerCount']); | ||
keys = Object.keys(My.prototype); | ||
assert.deepEqual(keys, ['on', 'off']); | ||
assert.deepEqual(keys, ['emit','on','off']); | ||
}); | ||
@@ -24,5 +26,5 @@ it('should include one method', function(){ | ||
var keys = Object.keys(My); | ||
assert.deepEqual(keys, ['defaultMaxListeners']); | ||
assert.deepEqual(keys, []); | ||
keys = Object.keys(My.prototype); | ||
assert.deepEqual(keys, ['on']); | ||
assert.deepEqual(keys, ['emit','on']); | ||
}); | ||
@@ -91,10 +93,12 @@ | ||
it('should not inject methods twice', function(){ | ||
var My = function(){}; | ||
var newExec = 0; | ||
var oldExec = 0; | ||
My.prototype.exec = function(){ | ||
var Root = function(){}; | ||
Root.prototype.exec = function(){ | ||
oldExec++; | ||
}; | ||
var My = function(){}; | ||
inherits(My, Root); | ||
eventable(Root, {methods: {exec: function(){newExec++;this['super']();}}}); | ||
eventable(My, {methods: {exec: function(){newExec++;this['super']();}}}); | ||
eventable(My, {methods: {exec: function(){newExec++;this['super']();}}}); | ||
var my = new My; | ||
@@ -101,0 +105,0 @@ my.exec(); |
Sorry, the diff of this file is not supported yet
1845
85970