I have a function which returns an object. Instead of returning the object synchronously, can I have it returned inside an observable which can be later resolved using callbacks (similar to an http call).
Caller Function:
getResource() {
this.someService.getData().subscribe((data) => {
this.playWithData(data);
}, (error) {
console.log(error);
});
}
Called Fn
getData() {
return data; //required to return observable/subscriber object
}
can you let know if this is possible and how to create and return an observable just like how http call would return one ?