Asynchronous Variables
Last updated
Was this helpful?
Was this helpful?
this.sendHTTPRequest(...)args.callback(returnValue);this.sendHTTPRequest(config: {
url: string;
method: string;
contentType?: string;
withCredentials?: boolean;
data?: string | object;
}, callback: (response: any) => void): voidfunction(args) {
this.sendHTTPRequest({
url: "https://track.adform.net/Serving/Cookie/?adfaction=getjs;adfcookname=uid",
method: "GET",
contentType: "text/plain",
withCredentials: true
},
function(res) {
args.callback(res.adform_id); // Return the ID from Adform
}
);
}Website (with JENTIS)
↓
Trigger fires state with async variable
↓
State execution pauses
↓
Asynchronous variable sends request via `sendHTTPRequest`
↓
Waits up to 2 seconds for response
↓
Callback received (or timeout)
↓
State and client-tags resume
↓
Data is sent to JENTIS Environment