Is there a way to get the hot observable from EventEmitter(or the equivalent available in Angular 2 alpha 46 / RxJS 5 alpha)? that is , if we sign after the value is resolved, it starts with the previously resolved value . Like what we have when we always return the same promise.
Ideally, only using Angular 2 objects (I read somewhere light RxJS will be later implemented later to remove the dependency), otherwise importing RxJS is fine. AsyncSubject seems to fit my needs, but it is not available in RxJS 5 alpha.
I tried the following, without success (never run). Any idea on how to use it?
let emitter = new EventEmitter<MyObj>();
setTimeout(() => {emitter.next(new MyObj());});
this.observable = emitter;
return this.observable.share();
The full plunker here compares hot and cold
Usecase : for some asynchronous objects, they are available only once (for example, a series of HTTP calls merged / wrapped in a new oneEventEmitter ), but providing a resolved asynchronous object to any service / component that subscribes to it, even if they subscribe after its resolution (answers received HTTP).
EDIT: , HTTP-, (?) EventEmitter , Angular 2 alpha 46/RxJS 5 alpha, / (HTTP - ). myEventEmitter.share() (cf plunker ), Observable, HTTP (cf plunker from @ ). Angular 2 alpha 46,.toRx() , EventEmitter .
promises, . HTTP Angular 2, promises (, , , promises, , promises).
share() ( doc - 5, Angular 2) - Observable, HTTP Angular 2, EventEmitter.
EDIT: , Observable, HTTP, , RxJS .
EDIT: : , HTTP.
!