A
A
Alexander Ivanov2019-05-06 14:11:46
Angular
Alexander Ivanov, 2019-05-06 14:11:46

How to build a queue in angular?

save_custom(): Observable<void> { // я всё вызываю и никак иначе
this.createFile() // я асинхронный и должен сработать вначале
return this.save_order() // я синхронный и я должен сработать в конце
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
msdosx86, 2019-05-10
@cimonlebedev

If this.createFile() returns an observable then

save_custom(): Observable<void> {
  return this.createFile()
    .pipe(
      tap(() => this.save_order()),
    );

If you have everything on promises, then as usual
async save_custom(): Promise<void> {
  await this.createFile();
  return await this.save_order();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question