Skip to content

Commit

Permalink
reference to original adapter method is now preserved
Browse files Browse the repository at this point in the history
  • Loading branch information
John Hann committed May 3, 2012
1 parent e7ce1fb commit 3b5beab
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Hub.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ define(function (require) {
if (typeof adapter[method] == 'function') {
if (eventFinder(method)) {
// store original method on proxy (to stop recursion)
proxy[method] = adapter[method];
proxy[method] = callOrigAdapterMethod(adapter, adapter[method]);
// change public api of adapter to call back into hub
observeAdapterMethod(adapter, method, adapter[method]);
// ensure hub has a public method of the same name
Expand All @@ -175,6 +175,12 @@ define(function (require) {
return adapter;
}

function callOrigAdapterMethod (adapter, orig) {
return function () {
return orig.apply(adapter, arguments);
};
}

function queueEvent (source, data, type) {
var queueNeedsRestart;

Expand Down

0 comments on commit 3b5beab

Please sign in to comment.