tildeio/conductor.js — pull request #11 by hjdivad (2013-05-02 22:19:06+00:00)
Title: Fix relative path loading.

Previously relative paths for nested cards would have an effective base
URI of the topmost card.

This also expands `Conductor.MultiplexService` to support optional data
transformations for requests and events. For example, the following is
used to transform requests in child cards so that they become absolute
URLs immediately, after which they are propagated to the containing
environment and requested directly.

```js
this.conductor.services.xhr = Conductor.MultiplexService.extend({
upstream: this.consumers.xhr,
transformRequest: function (requestEventName, data) {
var base = this.sandbox.options.url;
if (requestEventName === 'get') {
data.args = data.args.map(function (resourceUrl) {
var url = PathUtils.cardResourceUrl(base, resourceUrl);
return PathUtils.cardResourceUrl(document.baseURI, url);
});
}

return data;
}
});
```