Questions tagged [delay]

Delay refers to amount of time between two events.

Amount of time between two events.

3912 questions
2930
votes
13 answers

How can I make a time delay in Python?

I would like to know how to put a time delay in a Python script.
user46646
  • 133,483
  • 43
  • 73
  • 82
825
votes
32 answers

How to call a method after a delay in Android

I want to be able to call the following method after a specified delay. In objective c there was something like: [self performSelector:@selector(DoSomething) withObject:nil afterDelay:5]; Is there an equivalent of this method in android with…
aryaxt
  • 69,636
  • 87
  • 281
  • 421
346
votes
1 answer

JavaScript sleep/wait before continuing

I have a JavaScript code that I need to add a sleep/wait function to. The code I am running is already in a function, eg: function myFunction(time) { alert('time starts now'); //code to make the program wait before continuing alert('time…
user2370460
  • 6,320
  • 7
  • 27
  • 40
312
votes
14 answers

How to create a delay in Swift?

I want to pause my app at a certain in point. In other words, I want my app to execute the code, but then at a certain point, pause for 4 seconds, and then continue on with the rest of the code. How can I do this? I am using Swift.
Schuey999
  • 3,868
  • 5
  • 18
  • 35
240
votes
9 answers

Proper way to wait for one function to finish before continuing?

I have two JS functions. One calls the other. Within the calling function, I'd like to call the other, wait for that function to finish, then continue on. So, for example/pseudo code: function firstFunction(){ for(i=0;i
DA.
  • 36,871
  • 47
  • 133
  • 201
186
votes
10 answers

jQuery: Can I call delay() between addClass() and such?

Something as simple as: $("#div").addClass("error").delay(1000).removeClass("error"); doesn't seem to work. What would be the easiest alternative?
serg
  • 103,023
  • 70
  • 299
  • 324
149
votes
4 answers

Delaying function in swift

I don't have a code to sample or anything, because I have no idea how to do it, but can someone please tell me how to delay a function with swift for a set amount of time?
CoolMAn
  • 1,613
  • 2
  • 10
  • 17
147
votes
13 answers

How to put a delay on AngularJS instant search?

I have a performance issue that I can't seem to address. I have an instant search but it's somewhat laggy, since it starts searching on each keyup(). JS: var App = angular.module('App', []); App.controller('DisplayController', function($scope,…
braincomb
  • 1,612
  • 2
  • 11
  • 10
145
votes
4 answers

How to add a delay for a 2 or 3 seconds

How can I add a delay to a program in C#?
Mulder
  • 1,623
  • 2
  • 12
  • 7
141
votes
10 answers

jQuery: Wait/Delay 1 second without executing code

I can't get the .delay method working in jQuery: $.delay(3000); // not working $(queue).delay(3000); // not working I'm using a while loop to wait until an uncontrolled changing value is greater than or equal to another and I can't find any way to…
Brian Graham
  • 12,107
  • 12
  • 55
  • 95
121
votes
6 answers

How to reduce iOS AVPlayer start delay

Note, for the below question: All assets are local on the device -- no network streaming is taking place. The videos contain audio tracks. I'm working on an iOS application that requires playing video files with minimum delay to start the video…
Bernie Habermeier
  • 2,352
  • 2
  • 19
  • 19
100
votes
12 answers

Delayed function calls

Is there a nice simple method of delaying a function call whilst letting the thread continue executing? e.g. public void foo() { // Do stuff! // Delayed call to bar() after x number of ms // Do more Stuff } public void bar() { //…
TK.
  • 42,559
  • 46
  • 114
  • 145
82
votes
7 answers

Adding delay between execution of two following lines

I need to add delay between the execution of two lines in a(same) function. Is there is any favorable options to do this? Note: I don't need two different functions to do this, and the delay must not affect other functions' execution. eg: line 1:…
Krishna Raj Salim
  • 7,061
  • 5
  • 29
  • 62
80
votes
15 answers

While variable is not defined - wait

I have a click event that is triggered from another place automatically for the first time. My problem is that it runs too soon, since the required variables are still being defined by Flash and web services. So right now I have: (function ($) { …
JackLeo
  • 4,033
  • 8
  • 32
  • 65
80
votes
4 answers

How can I use delay() with show() and hide() in Jquery

How can I use delay() with show() and hide() in Jquery ?
faressoft
  • 17,177
  • 42
  • 96
  • 138
1
2 3
99 100