Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8429397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:19:33+00:00 2026-06-10T05:19:33+00:00

I have been working on writing a library of code for my future projects.

  • 0

I have been working on writing a library of code for my future projects. One of the functions I’ve been working on is a pause function. So far I have no problem with the errors reporting that the script is running to long even on pauses as long as 10 seconds. This is to primarily keep malicious users busy, it works well when you set a very long time. I was wondering if there are any errors that I should look out for that I might face?
Here’s the code…

pause = function(a) {
    var b = new Date().getTime();
    e = false;
    function wait() {
    d=10;
    for(i=0;i<d;i++) {
        d++;
        var c = new Date().getTime();
        if(c-b>=a) {
            e = true;
            break;
        }
        if(d>1000000) {
            break;
        }
    }
}
wait();
if(e==false) {
    pause(a-(new Date().getTime()-b));
}};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:19:35+00:00Added an answer on June 10, 2026 at 5:19 am

    You never ever want to do this sort of thing in Javascript. As you have noticed, the browser will complain about your script taking too long. Furthermore, this will take much more energy than necessary which is important for mobile devices with limited battery capacity.

    Instead, use the standard setTimeout() function to run code at a later time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working with the following code published on msdn: http://msdn.microsoft.com/en-us/library/fx6588te.aspx I understand
I am having trouble writing a query. I have been working with UNION on
I have been working with SQL Server as a Developer a while. One thing
I've been working on writing a library in my spare time to familiarize myself
I have been working in a business writing advanced software apps, and obviously im
I have been working to learn Mongodb effectively for one week in order to
So lately I have been working on writing a simple compiler to better understand
I am writing a C++ static library and I have been commenting with doxygen
I have been working on writing a few preprocessor macros in C to help
I have been working on a XSLT file here. I had been writing CSS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.