Skip Navigation LinksHome Page > Forums > Rapise Forums > Rapise Best Practices > What's the best way to de...
It is recommended to fine-tune the synchronization using one of the 2 available methods:1. Global.DoSleep(1000);Waits for 1 second. In many cases it is enough2. Global.DoWaitFor('MyObjectId', 10000);- Wait for given object up to 10 seconds. If object is found earlier then method unblocks.
Also you can use the following function (that you can add to your script file):
/*** Waits for specified value of object's property. Function returns object handle* if object was found and specified property equals to desired value or 'false' * in case of timeout.* @param obj ID of object to wait for or object itself.* @param getterName Property getter function name.* @param propValue Desired value.* @param [timeout = 10000] Maximum time to wait.* @param [params] Parameters for property getter function.* @returns Found object or 'false'.*/function DoWaitForProperty(/**String|SeSObject*/obj, /**String*/getterName, /**String|Number|Boolean*/ propValue, /**Number*/timeout, /**Array|String|Number|Boolean*/params) /**SeSObject|false*/{timeout = timeout||10000;params = params||[];if (typeof(params) != "object")params = [params];var start_ = new Date; var waitInt = 0;do{var res = null;if (typeof(obj) == "object")res = obj;elseres = SeSFindObj(obj);if(res){var prop = res[getterName];if (prop && typeof(prop) == "function"){var value = prop.apply(res, params);if (value === propValue){return res;}}}SeSSleep(100);} while((new Date - start_)<timeout);return false;}
You can use this new function using:
// Wait for timer to finishDoWaitForProperty('OnlineTimerTime', 'InnerText', "00:00:00", 10000);
And if you have any questions, please email or call us at +1 (202) 558-6885