Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Global object should be equal to the parent object. #46

Merged
merged 3 commits into from
Jul 6, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/docs/data.json
/docs/api.dust.js
/node_modules/
/node_modules/
.DS_Store
2 changes: 1 addition & 1 deletion EventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@
while (i--) {
// If the listener returns true then it shall be removed from the event
// The function is executed either with a basic call or an apply if there is an args array
response = args ? listeners[key][i].apply(null, args) : listeners[key][i]();
response = listeners[key][i].apply(this, args || []);
if (response === true) {
this.removeListener(evt, listeners[key][i]);
}
Expand Down
2 changes: 1 addition & 1 deletion EventEmitter.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,15 @@
ee.emitEvent(/ba[rz]/);
assert.strictEqual(count, 2);
});

test('global object is defined', function()
{
ee.addListener('foo', function() {
assert.equal(this, ee);
});

ee.emitEvent('foo');
});
});

suite('manipulateListeners', function() {
Expand Down