Skip to main content
Version: 11.2

$.udb.wait()

note

This article is about the wait() function of the udb object.

$.udb.wait()

Displays a Wait Control affecting the user's entire screen. This prevents the user from performing any additional actions while an operation is running.

tip

Several other calls, for example: $.udb.commit(), $.udb.checkData() and $.udb.executeSQLStatement(), have a waitState option. This is another way to display a Wait Control. In this case, the Wait Control is displayed when the function starts, and is hidden again automatically when the function has finished.

Returns a UdbPromise object.

Syntax

$.udb.wait( *activate*, *wait-message* )

$.udb.wait( *wait-function*, *wait-message* )

$.udb.wait( *wait-function*, *options* )

*activate* := { [true] | false | "off" }

*options* := {
[message]: *wait-message*,
[timeout]: *wait-timeout*
}

*wait-timeout* := Integer

Activate is a boolean that is used to turn the Wait Control on or off.

  • If activate is true, the Wait Control is displayed (with a wait-message, if specified) and the Wait Control count is increased.
  • If activate is false, the Wait Control count is reduced. If the Wait Control count is dropped to 0 or below, the Wait Control is also automatically removed.
  • If activate is "off", the Wait Control is removed and its count is reset to 0.

Wait-function is a function that is called while the Wait Control is displayed. The Wait Control is displayed (with a wait-message, if specified) before the function executes. The Wait Control is removed automatically when the function finishes.

Options is a struct that can have the following items, all of which are optional.

Wait-message is a message that is displayed for the time that the Wait Control is displayed. This message is also handled by the translation engine. The default is 'Loading...' .

Wait-timeout is an integer that indicates a time-out period in milliseconds that expires before wait-function executes. The time-out period starts when the Wait Control is displayed. Wait-function executes when the time-out period expires. The Wait Control is removed when the function finishes. The default for wait-timeout is 0, meaning that by default, no time-out period applies.

Examples

$.udb.wait( true );
$.udb.wait( () => {
//Prepare some results for committing
}, {
message: 'Processing results',
timeout: 2000
})
.then( () => $.udb.commit( { quiet: true }));