src/adLib.js
function (environment, options) {
    this.applicationId = options && options.applicationId;
    this.environment = environment;
    this.page = page;
    this.adManager = null;
    this.path = window.location.pathname;
    this.events = events;
    this.adManager = new AdManager(this.applicationId, this.deviceDetails, this.environment);
    appSettings.overrides = (options && options.overrides) || window.ADLIB_OVERRIDES || null;
    this.deviceDetails = deviceDetector.getDeviceDetails();

    // If the script include is placed in the <head> of the page,
    // document.body is not ready yet, and we need it to retrieve the token
    if (document.body) {
        page.preloadToken(this.environment);
    }
    page.addDomReadyListener(this.environment);

    if (options && options.setupGlobalApi) {
        //Only when this option is specified, setup the API on the global window
        this._setUpGlobalAPI();
    }
}
function (environment, options) {
    this.applicationId = options && options.applicationId;
    this.environment = environment;
    this.page = page;
    this.adManager = null;
    this.path = window.location.pathname;
    this.events = events;
    this.adManager = new AdManager(this.applicationId, this.deviceDetails, this.environment);
    appSettings.overrides = (options && options.overrides) || window.ADLIB_OVERRIDES || null;
    this.deviceDetails = deviceDetector.getDeviceDetails();

    // If the script include is placed in the <head> of the page,
    // document.body is not ready yet, and we need it to retrieve the token
    if (document.body) {
        page.preloadToken(this.environment);
    }
    page.addDomReadyListener(this.environment);

    if (options && options.setupGlobalApi) {
        //Only when this option is specified, setup the API on the global window
        this._setUpGlobalAPI();
    }
}
function ( environment , options ) { this . applicationId = options && options . applicationId ; this . environment = environment ; this . page = page ; this . adManager = null ; this . path = window . location . pathname ; this . events = events ; this . adManager = new AdManager ( this . applicationId , this . deviceDetails , this . environment ) ; appSettings . overrides = ( options && options . overrides ) || window . ADLIB_OVERRIDES || null ; this . deviceDetails = deviceDetector . getDeviceDetails ( ) ; // If the script include is placed in the <head> of the page, // document.body is not ready yet, and we need it to retrieve the token if ( document . body ) { page . preloadToken ( this . environment ) ; } page . addDomReadyListener ( this . environment ) ; if ( options && options . setupGlobalApi ) { //Only when this option is specified, setup the API on the global window this . _setUpGlobalAPI ( ) ; } }
Constructor that creates an instance of the AdLibrary object
@param environment - The environment object containing environment specific functions
@param [options] - Optional options to initialize the ad library with
@constructor
Constructor that creates an instance of the AdLibrary object