Monday, February 13, 2012

Delay (Sleep) in Xpages

We can make some delay for our execution on our client.

But in web, we don't have sleep function for making our process delayed.,

But we can overcome this issue with the calculation of starting time with our delaying time.,

Here is the code for delaying our execution (Millisecond is a delaying duration)

Which will work in CSJS and SSJS

function delay(millisecond)
var startTime = new Date().getTime(); // get the current time
while (new Date().getTime() < startTime + millisecond)

1 comment:

  1. Hi Ram,
    Thanks for the Idea. Can we load the Repeater Control like 30docs every 100ms?

    The basic reason is, I dont want 5000docs to be displayed at a time, rather to be one by one to reduce loading time.