Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove check for sender on channel. #1407

Merged
merged 11 commits into from
Aug 28, 2017
2 changes: 1 addition & 1 deletion lib/channels/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default class Channel {

_handleEvent(event) {
const listeners = this._listeners[event.type];
if (event.from !== this._sender && listeners) {
if (listeners) {
listeners.forEach(fn => fn(...event.args));
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/channels/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ describe('Channel', () => {
});

describe('_miscellaneous', () => {
it('should ignore if event came from itself', () => {
it('should not ignore if event came from itself', () => {
const received = [];
channel.on('type-1', n => received.push(n));
channel._handleEvent({ type: 'type-1', args: [11] });
channel._handleEvent({ type: 'type-1', args: [12], from: channel._sender });
expect(received).toEqual([11]);
expect(received).toEqual([11, 12]);
});
});
});