onLoadingComplete function

If your task is an event handler and supports the launch with context and switch launching option, after your task subscribes to the event types it can handle, call the onLoadingComplete function to inform z/OSMF core that your task is ready to receive events.

Invoking the function

To call the onLoadingComplete function, use the syntax shown in Figure 1.

Figure 1. Syntax to use to call the onLoadingComplete function
win.global.applinker.onLoadingComplete(suppressInitialEvents);

where, suppressInitialEvents is a Boolean variable that indicates the following:

true
Indicates that z/OSMF core will suppress the event that was used to initially launch your task. That is, z/OSMF core will ignore the first event, but will deliver subsequent events to the task.
Tip: Consider setting the suppressInitialEvents variable to true if you always want your task to load a certain way. For example, you might opt to set this variable to true, if you want your task to display a warning message or other important information that users must review before proceeding with your task.

If you want your task to process the initial event at a later time, assuming that no subsequent events have been received, you can retrieve the event information by calling the getEventFromUrl function and pass that information to the callback function that z/OSMF core would have called.

false
Indicates that z/OSMF core will deliver the event that was used to initially launch your task so that your task can display the correct context.
Tip: If you want to set the suppressInitialEvents variable to false, you can use the syntax that is provided in either of the following options:
 
//Option 1:  
call win.global.applinker.onLoadingComplete(false);

//Option 2:  
call win.global.applinker.onLoadingComplete();
 

Example

function init(){
   setupMyPlugin();
}

function setupMyPlugin(){
    //Perform setup actions.
    ...
    //Call the onLoadingComplete function to indicate that loading is
    //complete so the task can switch context.
    win.global.applinker.onLoadingComplete(false);
}