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

Commit

Permalink
fixed request return values from handler
Browse files Browse the repository at this point in the history
  • Loading branch information
krismeister authored and jasonLaster committed Apr 26, 2014
1 parent b53fc5a commit cd94db9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions spec/javascripts/radio/reqres.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,26 @@ describe('radio.reqres', function() {
});

});

describe('passing data between the handler and the request', function() {

var ch, chName, fn, returnObject;

beforeEach(function() {
chName = 'test';
reqName = 'some:request';
fn = function(p1, p2){
return p1 + p2;
};

Wreqr.radio.reqres.setHandler( chName, reqName, fn );
returnObject = Wreqr.radio.reqres.request( chName, reqName , 1, 2);
});

it( 'should pass parameters to handler from request', function() {
expect( returnObject ).toEqual(3);
});

});

})
2 changes: 1 addition & 1 deletion src/wreqr.radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Wreqr.radio = (function(Wreqr){
var messageSystem = radio._getChannel(channelName)[system];
var args = Array.prototype.slice.call(arguments, 1);

messageSystem[method].apply(messageSystem, args);
return messageSystem[method].apply(messageSystem, args);
};
};

Expand Down

0 comments on commit cd94db9

Please sign in to comment.