$.udb.applyCurrentContext()
This article is about the applyCurrentContext() function of the $.udb object.
$.udb.applyCurrentContext()
Switches the default context of the function to the context of the preceding Promise, or the Promise specified instead.
Syntax
$.udb.applyCurrentContext( *promise-func*, [context], [page-alias] )
The mandatory promise-func parameter is the function passed to one of the outcome functions of a Promise or UdbPromise, typically a .then(), a .catch() or a .finally() clause.
The optional context overrides the current context directly with its value, e.g. '' or 'ApplicationFrame'.
The optional page-alias overrides the current page alias context directly with its value, e.g. "P1".
Omitting context will just execute the promise function with the context of its preceding Promise.
This function is used to elevate a Promise-function to a given context and/or page alias. Since this behavior is automatically performed by the UdbPromise already, it makes more sense to use these instead of the $.udb.applyCurrentContext() function.
Usage of the page-alias option should be avoided. These aliases are generated and not easily derivable in a web page. If execution in a certain (embedded) page context is required, the UdbPromise can already take care of this effectively.
Example
set.refresh()
.then(
$.udb.applyCurrentContext(() => {
success();
},
set.context)
);