delay

How to pause jQuery code for few milliseconds?

限于喜欢 提交于 2019-12-10 11:33:47
问题 I'm using jQuery Ajax functions to auto update my database through cron. Since there are a lot of rows to be updated, I'd like to pause the code for few milliseconds each iretation. What would be the best way to do it? Here's sample of my code: <?php $zdroje = $db->select('zdroje', 'id!=1'); echo "<script type='text/javascript'>\n $(document).ready(function() {\n"; foreach($zdroje as $zdroj) { echo "$.post( '/adminator/menu/2zajezdy/tools/01otnXml/requests.php', { 'updateXML': '".$zdroj['id']

Wait before ShellExecute is carried out?

混江龙づ霸主 提交于 2019-12-09 16:22:02
问题 I have a hopefully quick question: Is it possible to delay execution of ShellExecute a little bit? I have an application with autoupdater. After it downloads all necessary files etc, it renames current files to *.OLD and the new as the previous. Simple enough. But then I need to delete those .OLD files. This 'cleanup' procedure is executed on MainForm.OnActivate (with a check if it is the first activate proc). But this apparently happens too fast (I get False from DeleteFile). This is the

setTimeout fires immediately if the delay more than 2147483648 milliseconds

こ雲淡風輕ζ 提交于 2019-12-09 16:18:15
问题 The problem If the delay is more than 2147483648 milliseconds(24.8551 days) the function will fire immediately. Example setTimeout(function(){ console.log('hey') }, 2147483648) // this fires early setTimeout(function(){ console.log('hey') }, 2147483647) // this works properly I tried it under Chrome v26 and Node.js v8.21 回答1: The upper limit of setTimeout is 0x7FFFFFFF (or 2147483647 in decimal) This is because setTimeout uses a 32bit integer to store its delay value, so anything above that

Delay load of iframe?

时光毁灭记忆、已成空白 提交于 2019-12-09 15:04:43
问题 I know there are some tools and techniques for delaying the load of javascript, but I have an iframe that I would like to delay loading until after the rest of the page has finished downloading and rendering (the iframe is in a hidden that will not be revealed until someone clicks on a particular tab on the page. Is there a way to delay the load of an iframe? Any suggestions would be much appreciated. Thanks! 回答1: with jquery it is easy! either enclose your code which loads the iframe within

Task.Delay never completing

吃可爱长大的小学妹 提交于 2019-12-09 14:54:55
问题 The following code will freeze forever. public async Task DoSomethingAsync() { await Task.Delay(2000); } private void Button_Click(object sender, RoutedEventArgs e) { DoSomethingAsync().Wait(); // Task.Delay(2000).Wait(); } If I switch the call to DoSomethingAsync with the commented out code, it behaves as expected. I suspect that somehow the nested awaits are causing a deadlock, but I'm not sure why, or how to fix it. 回答1: Assuming Button_Click runs in the GUI thread you have a deadlock on

JQuery delay before fadeOut

核能气质少年 提交于 2019-12-09 08:19:04
问题 I have written a jquery script that allows me to fade divs in and out, then repeat. The code works fine. However, when I try to add a delay (I want the div to stay up a few seconds before fading out), it does not work properly. I've tried adding the delay in several places inside the code and none seem to function properly. I am using Jquery version 1.9.1 Here is the script that I have written: $(document).ready(function(){ ShowPostDiv(0); }); function ShowPostDiv(divIndex) { $(".home_entry

DispatchQueue.main.asyncAfter is inaccurate

孤街浪徒 提交于 2019-12-09 00:34:13
问题 I am trying to call a function after a delay. On iOS10 I am able to use Timer.scheduledTimer which does indeed call my closure after the given delay. However, on iOS9 I am using DispatchQueue.main.asyncAfter and it calls my closure with a six second delay. The delay I am testing with is 60 seconds. Timer.scheduledTimer calls closure after 60 seconds, DispatchQueue.main.asyncAfter after 66 seconds. The six second delay is consequent, if I schedule two delays of 60 seconds the second delay is

How to delay showing of progress if ajax takes less than X seconds?

别等时光非礼了梦想. 提交于 2019-12-09 00:14:55
问题 I've got a few AJAX calls on a page. Some complete instantaneously, others take a few moments -- all depending upon what is clicked. I want to add a "loader" that will display after X seconds while AJAX is working on results. I've got a loader working: $(document).ajaxStart(function() { $("#loader").css("display","block"); }).ajaxSuccess(function() { $("#loader").css("display","none"); }); This functions. However, it flashes on screen when the AJAX request is fast... like in the blink of an

iOS: Why touchesBegan has some delay in some specific area in UIView

一笑奈何 提交于 2019-12-08 18:53:16
问题 I'm making an custom keyboard and I'm in a really weird situation. I've noticed that when I catch the event touchesBegan at the rear left (about 20 pixels) of the UIView (inputView), I'll have some delay in here. Any action I do in touchesBegan will be perform slower than other area. override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) { self.keypop.hidden = false } override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { { self.keypop.hidden =

Task.Delay vs DispatcherTimer?

倾然丶 夕夏残阳落幕 提交于 2019-12-08 15:33:14
问题 I'm considering use Task.Delay() for a non-stop timer, because it's more simple and readable. As I'm new to .NET, I see no significant difference between the two codes. Can you show me the difference (if there is any) between them? // Create variable at some place DispatcherTimer timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(5); timer.Tick += timer_Elapsed; timer.Start(); // Function other place void timer_Elapsed(object sender, EventArgs e) { //Do stuff } vs // Every