2015-08-17 10:28:47 -07:00
|
|
|
import {Injectable} from 'angular2/di';
|
2015-08-21 16:55:50 -07:00
|
|
|
import {PRIMITIVE} from 'angular2/src/web_workers/shared/serializer';
|
2015-08-21 12:21:29 -07:00
|
|
|
import {XHR_CHANNEL} from 'angular2/src/web_workers/shared/messaging_api';
|
2015-08-20 14:28:25 -07:00
|
|
|
import {XHR} from 'angular2/src/core/render/xhr';
|
2015-08-21 16:55:50 -07:00
|
|
|
import {ServiceMessageBrokerFactory} from 'angular2/src/web_workers/shared/service_message_broker';
|
|
|
|
import {bind} from './bind';
|
2015-08-17 10:28:47 -07:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class MessageBasedXHRImpl {
|
2015-08-21 16:55:50 -07:00
|
|
|
constructor(brokerFactory: ServiceMessageBrokerFactory, private _xhr: XHR) {
|
|
|
|
var broker = brokerFactory.createMessageBroker(XHR_CHANNEL);
|
|
|
|
broker.registerMethod("get", [PRIMITIVE], bind(this._xhr.get, this._xhr), PRIMITIVE);
|
2015-08-17 10:28:47 -07:00
|
|
|
}
|
|
|
|
}
|