luistak / windowed-observable

Messaging lib using a pub/sub observable scoped by namespaces.
MIT License
162 stars 15 forks source link

Add async pipe support #180

Open Adrian1907 opened 2 years ago

Adrian1907 commented 2 years ago

Describe the feature you'd like:

I would like to have a possibility to use windowed-observable directly in a html-template via async pipe.

luistak commented 2 years ago

Hi @Adrian1907 thanks for your issue, but could you elaborate on the request with a few examples, suggestions of API, and usages?

Adrian1907 commented 2 years ago

Hi @luistak, the build-in async pipe allows to use asyncronuous things like Observable or Promise in a template. Source: https://angular.io/api/common/AsyncPipe It would be nice to have a possibility to use windowed-observable the same way as usual observable and not only with subscribe. For example the next way:

import { Observable as WindowedObservable } from 'windowed-observable';

@Component({
  selector: 'my-selector',
  template: '<div>{{ myWindowedObservable | async }}</div>'
})
export class ExampleComponent {
  myWindowedObservable = new WindowedObservable('myNameSpace');
}
jsanta commented 1 year ago

@Adrian1907 I know my message comes kind of late. Did you try wrapping windowObservable in a the RXJS from() ? Don't know if it will work, but I think there's a slight chance.