Here is a possible solution which you may find useful...
Have a function namespace where all your logic resides, such as:
this.fn = {};
this.fn['save'] = function() {};
this.fn['load'] = function() {};
And when your events get fired, you simply use the appropriate function as in:
var fn = this.fn['load'];
or
var fn = this.fn['save'];
And then use 'fn' as you normally would.
You could even separate your functions by modules, such as 'online.js' and 'offline.js' where each module would have the same function names, but bound to it's own namespace.
When time comes to re-link the functions, you could simply do something like:
this.fn['load'] = offlineModule.fn['load'];
If you have a name for all your functions (ie: 'load', 'save') you could simply have it in a loop.
The above avoids all of the 'if/else' condition branches which can get annoying at times and instead attempts to use a kind of pattern.
But great question anyway, cause I'm starting a planning phase for a project and I will need something similar to what you describe in your question... so far, this is the best solution I have for it. Essentially inspired by the dynamic linking of SO in Linux (kind of).