Show:

F2.ContainerConfig Class

An object containing configuration information for the container

Methods

Name Description
afterAppRender (
  • appConfig
  • html
)
deprecated

Allows the container to override how an app's html is inserted into the page. The function should accept an F2.AppConfig object and also a string of html

appRender (
  • appConfig
  • html
)
deprecated

Allows the container to wrap an app in extra html. The function should accept an F2.AppConfig object and also a string of html. The extra html can provide links to edit app settings and remove an app from the container. See F2.Constants.Css for CSS classes that should be applied to elements.

beforeAppRender (
  • appConfig
)
deprecated

Allows the container to render html for an app before the AppManifest for an app has loaded. This can be useful if the design calls for loading icons to appear for each app before each app is loaded and rendered to the page.

xhr (
  • url
  • appConfigs
  • success
  • error
  • complete
)

Allows the container to fully override how the AppManifest request is made inside of F2.

xhr.dataType (
  • url
  • appConfigs
)

Allows the container to override the request data type (JSON or JSONP) that is used for the request

xhr.type (
  • url
  • appConfigs
)

Allows the container to override the request method that is used (just like the type parameter to jQuery.ajax().

xhr.url (
  • url
  • appConfigs
)

Allows the container to override the url that is used to request an app's F2.F2.AppManifest

Properties

Name Description
debugMode

True to enable debug mode in F2.js. Adds additional logging, resource cache busting, etc.

isSecureAppPage

Tells the container that it is currently running within a secure app page

loadScripts

Allows the container to override the script loader which requests dependencies defined in the F2.AppManifest.

loadStyles

Allows the container to override the stylesheet loader which requests dependencies defined in the F2.AppManifest.

locale

The default language and region specification for this container represented as an IETF-defined standard language tag, e.g. "en-us" or "de-de". This value is passed to each app registered as containerLocale.

scriptErrorTimeout

Milliseconds before F2 fires callback on script resource load errors. Due to issue with the way Internet Explorer attaches load events to script elements, the error event doesn't fire.

secureAppPagePath

Allows the container to specify which page is used when loading a secure app. The page must reside on a different domain than the container

supportedViews

Specifies what views a container will provide buttons or links to. Generally, the views will be switched via buttons or links in the app's header.

xhr

Allows the container to override individual parts of the AppManifest request. See properties and methods with the xhr. prefix.

Methods

afterAppRender (
  • appConfig
  • html
) deprecated

Defined in sdk\src\classes.js:251

Deprecated: This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0

Allows the container to override how an app's html is inserted into the page. The function should accept an F2.AppConfig object and also a string of html

Parameters:

  • appConfig F2.AppConfig

    The F2.AppConfig object

  • html String

    The string of html representing the app

Returns:

Element:

The DOM Element surrounding the app


appRender (
  • appConfig
  • html
) deprecated

Defined in sdk\src\classes.js:263

Deprecated: This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0

Allows the container to wrap an app in extra html. The function should accept an F2.AppConfig object and also a string of html. The extra html can provide links to edit app settings and remove an app from the container. See F2.Constants.Css for CSS classes that should be applied to elements.

Parameters:

  • appConfig F2.AppConfig

    The F2.AppConfig object

  • html String

    The string of html representing the app


beforeAppRender (
  • appConfig
) deprecated

Defined in sdk\src\classes.js:277

Deprecated: This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0

Allows the container to render html for an app before the AppManifest for an app has loaded. This can be useful if the design calls for loading icons to appear for each app before each app is loaded and rendered to the page.

Parameters:

Returns:

Element:

The DOM Element surrounding the app


xhr (
  • url
  • appConfigs
  • success
  • error
  • complete
)

Allows the container to fully override how the AppManifest request is made inside of F2.

Parameters:

  • url String

    The manifest url

  • appConfigs Array

    An array of F2.AppConfig objects

  • success Function

    The function to be called if the request succeeds

  • error Function

    The function to be called if the request fails

  • complete Function

    The function to be called when the request finishes (after success and error callbacks have been executed)

Returns:

XMLHttpRequest:

The XMLHttpRequest object (or an object that has an abort function (such as the jqXHR object in jQuery) to abort the request)

Example:

F2.init({
    xhr: function(url, appConfigs, success, error, complete) {
        $.ajax({
            url: url,
            type: 'POST',
            data: {
                params: F2.stringify(appConfigs, F2.appConfigReplacer)
            },
            jsonp: false, // do not put 'callback=' in the query string
            jsonpCallback: F2.Constants.JSONP_CALLBACK + appConfigs[0].appId, // Unique function name
            dataType: 'json',
            success: function(appManifest) {
                // custom success logic
                success(appManifest); // fire success callback
            },
            error: function() {
                // custom error logic
                error(); // fire error callback
            },
            complete: function() {
                // custom complete logic
                complete(); // fire complete callback
            }
        });
    }
});

xhr.dataType (
  • url
  • appConfigs
)

Allows the container to override the request data type (JSON or JSONP) that is used for the request

Parameters:

  • url String

    The manifest url

  • appConfigs Array

    An array of F2.AppConfig objects

Returns:

String:

The request data type that should be used

Example:

F2.init({
    xhr: {
        dataType: function(url) {
            return F2.isLocalRequest(url) ? 'json' : 'jsonp';
        },
        type: function(url) {
            return F2.isLocalRequest(url) ? 'POST' : 'GET';
        }
    }
});

xhr.type (
  • url
  • appConfigs
)

Allows the container to override the request method that is used (just like the type parameter to jQuery.ajax().

Parameters:

  • url String

    The manifest url

  • appConfigs Array

    An array of F2.AppConfig objects

Returns:

String:

The request method that should be used

Example:

F2.init({
    xhr: {
        dataType: function(url) {
            return F2.isLocalRequest(url) ? 'json' : 'jsonp';
        },
        type: function(url) {
            return F2.isLocalRequest(url) ? 'POST' : 'GET';
        }
    }
});

xhr.url (
  • url
  • appConfigs
)

Allows the container to override the url that is used to request an app's F2.F2.AppManifest

Parameters:

  • url String

    The manifest url

  • appConfigs Array

    An array of F2.AppConfig objects

Returns:

String:

The url that should be used for the request

Example:

F2.init({
    xhr: {
        url: function(url, appConfigs) {
            return 'http://example.com/proxy.php?url=' + encocdeURIComponent(url);
        }
    }
});

Properties

debugMode Bool

True to enable debug mode in F2.js. Adds additional logging, resource cache busting, etc.

Default: false


isSecureAppPage Bool

Tells the container that it is currently running within a secure app page


loadScripts Function

Allows the container to override the script loader which requests dependencies defined in the F2.AppManifest.

Example:

F2.init({
        loadScripts: function(scripts,inlines,callback){
            //load scripts using $.load() for each script or require(scripts)
            callback();
        }
});

loadStyles Function

Allows the container to override the stylesheet loader which requests dependencies defined in the F2.AppManifest.

Example:

F2.init({
        loadStyles: function(styles,callback){
            //load styles using $.load() for each stylesheet or another method
            callback();
        }
});

locale String

Defined in sdk\src\classes.js:295

Available since 1.4.0

The default language and region specification for this container represented as an IETF-defined standard language tag, e.g. "en-us" or "de-de". This value is passed to each app registered as containerLocale.

Default: null


scriptErrorTimeout Milliseconds

Milliseconds before F2 fires callback on script resource load errors. Due to issue with the way Internet Explorer attaches load events to script elements, the error event doesn't fire.

Default: 7000 (7 seconds)


secureAppPagePath String

Allows the container to specify which page is used when loading a secure app. The page must reside on a different domain than the container


supportedViews Array

Specifies what views a container will provide buttons or links to. Generally, the views will be switched via buttons or links in the app's header.


xhr Object

Allows the container to override individual parts of the AppManifest request. See properties and methods with the xhr. prefix.

Example:

F2.init({
    xhr: {
        url: function(url, appConfigs) {
            return 'http://example.com/proxy.php?url=' + encocdeURIComponent(url);
        }
    }
});