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

  • Home
  • SEARCH
  • 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 6919813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:02:51+00:00 2026-05-27T10:02:51+00:00

I want to load an OWL file before executing other (visualisation-)scripts. To do this

  • 0

I want to load an OWL file before executing other (visualisation-)scripts. To do this I tried everything from

$(document).ready

to

function visualize (file) {
if (!file)
    {setTimeout(visualize(file), 2000)}
else
    {jQuery(function($){visFeaturePool.init(file)})}}

I think it has to be possible with the setTimeout but that isn’t working. I throws the error:
Uncaught RangeError: Maximum call stack size exceeded, so it doesn’t wait, it just recalls the visualize function untill the stack is full.

Does anybody know what I am doing wrong?
Thanks!

  • 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-05-27T10:02:52+00:00Added an answer on May 27, 2026 at 10:02 am

    Instead of

    // #1
    setTimeout(visualize(file), 2000);
    

    you want

    // #2
    setTimeout(function() {
        visualize(file);
    }, 2000);
    

    or on modern browsers, you can provide arguments to pass to the function after the delay:

    // #3
    setTimeout(visualize, 2000, file);
    

    Those three explained:

    1. (As SLaks mentions) This calls visualize immediately, and then passes its return value into setTimeout (and since visualize calls itself, it keeps calling itself recursively and you end up with a stack overflow error).
    2. This passes a function reference into setTimeout that, when called, will call visualize and pass it the file argument (with its value as it is then). The function we’re passing into setTimeout will have access to the file argument, even though your code has run and returned, because that function is a closure over the context in which it was created, which includes file. More: Closures are not complicated Note that the file variable’s value is read as of when the timer fires, not when you set it up.
    3. This passes the visualize function reference into setTimeout (note we don’t have () or (file) after it) and also passes file into setTimeout, using its value as of when you set up the call. Later, in modern environments, setTimeout will pass that on to the function when calling it later.

    There’s an important difference between #2 and #3: With #2, if file is changed between when setTimeout is called and the timer expires, visualize will see file‘s new value. With #3, though, it won’t. Both have their uses. Here’s an example of that difference:

    let file = 1;
    
    // #2, using "file" when the timer fires, not when you set it up
    setTimeout(function() { visualize(file); }, 2000); // Shows 2
    
    // #3, using "file" right away when setting up the timer
    setTimeout(visualize, 2000, file); // Shows 1
    
    file = 2;
    
    function visualize(value) {
        console.log(value);
    }

    If you needed #3’s behavior of immediately reading file (rather than waiting until the timer fires) in an environment that didn’t support extra arguments to setTimeout, you could do this:

    // #4 (for environments that don't support #3)
    setTimeout(visualize.bind(null, file), 2000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to load a static text file from an HTML document without using
I want to load some helper in a model. How to do this? Tried
I want to load some images into my application from the file system. There's
I want to load some data from mysql into my cocoa application view before
I want to load defined folders into my website from same system, now I
I want to load key/values configuration pairs stored in XML file. To bind a
I want to load the image URL from my NSMutableArray. Here is my Code:
I want to load an XML document in Xerces-C++ (version 2.8, under Linux), and
I want to load this simple something into my Editor: Write:-repeat,write(hi),nl,fail. So that it
I want to load an extra config file based on the controller's name in

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.