Events

NTF-ATW-EVENT

NTF-ATW-EVENT is triggered when an event is received by the JavaScript, when the JavaScript has been injected via the ATW-SCRIPT.

                EVALUATE EVENT-TYPE
           WHEN NTF-ATW-EVENT
             EVALUATE event-data-1
               WHEN 1
                     modify js1 CALL("googleMaps")
                     modify js1 add("script2",
                            "[SRC]:/js/myscript2.js")LAST-ERROR 
Note: The only event triggered by AcuToWeb occurs when the ADDed script has finished loading.

If you want to notify to the COBOL program of any other event, you can use the CustomJSHelper.event helper in your JavaScript code as follows:

getData: function(_url) {    $.ajax({url:_url}).then( function(data)
        { getDataObj.dataReturn = JSON.stringify(data);
        CustomJSHelper.event("getDataObj", CustomJSHelper.DATA_LOADED, 1);     }); 
        },getReturn: function(){ return getDataObj.dataReturn; }

Values for EVENT-DATA-1 can be:

ATW_SCRIPT_LOADED = 1 Script loaded
ATW_SCRIPT_CUSTOM_EVENT = 2 Custom event; the JavaScript developer can generate a custom event from JavaScript to COBOL
ATW_JSON_DATA_LOADED = 3 JSON is loaded; the JavaScript developer can use it when the ajax function returns a value from the webservice call
ATW_JSON_ERROR_DATA_LOADED = 4 JSON is error loaded; the JavaScript developer can use it when the ajax function returns an error from the webservice call

When the value of EVENT-DATA-1 is CUSTOM_EVENT or DATA_LOADED or ERROR_DATA_LOADED

EVENT-DATA-2 is a number, defined by the JavaScript developer, that identifies the number of AJAX operations contained in the JavaScript code.