Callback of #class CSP request
Hi,
I only use Caché and CSP, I am making a simple request in CSP page with #call method, and I have to define a callback of this #call method, can I do this?
This is my simple request in CSP page (javascript):
PainelBordoResource.prototype.obterIndicador = function(requisicaoParametros) {
let retorno = #call(painelbordo.PainelBordoResource.obterIndicador(angular.toJson(requisicaoParametros)))#;
return retorno;
};
Comments
Use #server if you want to wait for a response, but be warned though that JavaScript is one threaded, and using #server with a left-hand side (LHS) variable would lock the current thread.
If you don't specify a LHS you can continue using #call, that will inform the CSP Gateway to execute the request asynchronously.
More details here: http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY…
If you need something closer to a callback then must do your callback on the server using &js< /* your javascript code here */ >. This way the server will return a "runtime" JavasScript to execute remaining operations on the client side.