question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

delay failed on ajax call

See original GitHub issue

I am trying to delay the ajax call.

RxJS version: 5.52

Code to reproduce:

ajax.get(url).delay(1000);

Expected behavior: Delay 1s

Actual behavior: No delay

Additional information: I found the walkaround way at here by

Observable.timer(1000).flatMapLatest(ajax.get(url))

But it would be great to fix it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Brooooooklyncommented, Nov 30, 2017

in this case

const a$ = ajax.get(url).delay(1000)

when you called a$.subscribe , ajax would execute immediately. delay operator here is just take the response of ajax and delay to pass it to next operator.

subscribeOn take a scheduler, which means it would change your subscribe time scheduler.

it just equal to:

setTimeout(() => {
  $a.subscribe()
}, 1000)

remember, whenever you call subscribe on a Observable, the source of this Observable would execute immediately, only subscribeOn operator could change it.

0reactions
lock[bot]commented, Jun 5, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

delay in ajax success not working - Stack Overflow
Using setTimeout( function, time ) is the best solution. But if you want to animate the button, you can make it with jQuery...
Read more >
How to set timeout for ajax by using jQuery? - GeeksforGeeks
In responsive interface, the programmer needs to delay the ajax request to achieve some task before the response. This can be achieved by ......
Read more >
Delay AJAX call for X seconds - SitePoint
jQuery code snippet to delay AJAX call for X seconds. Could be used for events that require action before getting data from the...
Read more >
Ajax (remote data) - The jQuery replacement for select boxes
Simply use the ajax.delay configuration option to tell Select2 how long to wait after a ... success, failure) { var request = new...
Read more >
slow jquery ajax response - Google Groups
Hi all, I have a jquery ajax call below to bitly that on occasion takes over 2 minutes to finish when it fails...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found