JavaScript - Immediately Invoked Function Expressions

Hi all,

Something I use in addtion to or in lieu of a Startup Function/JavaScript component combination is something known as an Immediately Invoked Function Expression (IIFE).  Please note that the functionality an IIFE provides is not specific to Pipeline Pilot: it is a general JavaScript idiom.

More detail than I can provide here is given on the relevant Wikipedia page.

One possible advantage that would be specific to Pipeline Pilot is that IIFEs will get executed even before any Startup Functions do.  This is true regardless of the relative ordering of a JavaScript component with an IIFE and a Startup Function in a reporting protocol.

I've attached a protocol as a demonstration, and the Wikipedia link above is very informative, but I'll repeat the IIFE syntax here, using a simple example:

(function(a, b) {
    alert(a + ', ' + b);
})("hello", "world")

Cheers,

@CS