-1
My application has a service that runs an observable every time I click a button. The problem is that if I click several times on the button it runs the Observable several times at the same time. I needed this service to queue up and run 1 at a time. What better way to do this?
EDIT: Source
// component
onClick(record){
  this.myService.updateRecord(params).subscribe();
}
// service
updateRecord(record){
  return new Observable((observer) => {
    Observable.forkJoin(
      Observable.fromPromise(this.storage.get('things')),
      Observable.fromPromise(this.storage.get('other_things'))
    ).subscribe(
      (results) => {
        let things = results[0] || []
        let other_things = results[1] || []
        // do stuffs 
        observer.next([record])
        observer.complete()
      })
  })
}
						
could show the source code of how this is being done?
– mercador
added @mercador
– Ruby Dev Junior