F2.Constants.AppHandlers Class
Constants used throughout the Open Financial Framework
src\constants\appHandlers.js:1
Properties
Name | Description |
---|---|
APP_CREATE_ROOT static | Identifies the create root method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appConfig ) |
APP_DESTROY static | Identifies the app destroy method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appInstance ) |
APP_DESTROY_AFTER static | Identifies the after app destroy method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appInstance ) |
APP_DESTROY_BEFORE static | Identifies the before app destroy method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appInstance ) |
APP_MANIFEST_REQUEST_FAIL static | When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appConfig ) |
APP_RENDER static | Identifies the app render method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appConfig, appHtml ) |
APP_RENDER_AFTER static | Identifies the after app render method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appConfig ) |
APP_RENDER_BEFORE static | Identifies the before app render method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appConfig ) |
APP_SCRIPT_LOAD_FAILED static | Identifies the app script load failed method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appConfig, scriptInfo ) |
Properties
APP_CREATE_ROOT String final static
Identifies the create root method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appConfig )
Example:
var _token = F2.AppHandlers.getToken();
F2.AppHandlers.on(
_token,
F2.Constants.AppHandlers.APP_CREATE_ROOT,
function(appConfig)
{
// If you want to create a custom root. By default F2 uses the app's outermost HTML element.
// the app's html is not available until after the manifest is retrieved so this logic occurs in F2.Constants.AppHandlers.APP_RENDER
appConfig.root = document.createElement('section');
}
);
APP_DESTROY String final static
Identifies the app destroy method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appInstance )
Example:
var _token = F2.AppHandlers.getToken(); F2.AppHandlers.on( _token, F2.Constants.AppHandlers.APP_DESTROY, function(appInstance) { // call the apps destroy method, if it has one if(appInstance && appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function') { appInstance.app.destroy(); } else if(appInstance && appInstance.app && appInstance.app.destroy) { F2.log(appInstance.config.appId + ' has a destroy property, but destroy is not of type function and as such will not be executed.'); }
// remove the root appInstance.config.root.parentNode.removeChild(appInstance.config.root); } );
APP_DESTROY_AFTER String final static
Identifies the after app destroy method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appInstance )
Example:
var _token = F2.AppHandlers.getToken(); F2.AppHandlers.on( _token, F2.Constants.AppHandlers.APP_DESTROY_AFTER, function(appInstance) { F2.log(appInstance); } );
APP_DESTROY_BEFORE String final static
Identifies the before app destroy method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appInstance )
Example:
var _token = F2.AppHandlers.getToken();
F2.AppHandlers.on(
_token,
F2.Constants.AppHandlers.APP_DESTROY_BEFORE,
function(appInstance)
{
F2.log(appInstance);
}
);
APP_MANIFEST_REQUEST_FAIL String final static
When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appConfig )
Example:
var _token = F2.AppHandlers.getToken();
F2.AppHandlers.on(
_token,
F2.Constants.AppHandlers.APP_MANIFEST_REQUEST_FAIL,
function(appConfig)
{
You can use information from the appConfig to surface a custom error message in the dom
Or display some kind of default error placeholder element rather than having a blank spot in the dom
}
);
APP_RENDER String final static
Identifies the app render method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appConfig, appHtml )
Example:
var _token = F2.AppHandlers.getToken(); F2.AppHandlers.on( _token, F2.Constants.AppHandlers.APP_RENDER, function(appConfig, appHtml) { // if no app root is defined use the app's outer most node if(!appConfig.root) { appConfig.root = domify(appHtml); } else { // append the app html to the root appConfig.root.appendChild(domify(appHtml)); }
// append the root to the body by default. document.body.appendChild(appConfig.root); } );
APP_RENDER_AFTER String final static
Identifies the after app render method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appConfig )
Example:
var _token = F2.AppHandlers.getToken();
F2.AppHandlers.on(
_token,
F2.Constants.AppHandlers.APP_RENDER_AFTER,
function(appConfig)
{
F2.log(appConfig);
}
);
APP_RENDER_BEFORE String final static
Identifies the before app render method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appConfig )
Example:
var _token = F2.AppHandlers.getToken();
F2.AppHandlers.on(
_token,
F2.Constants.AppHandlers.APP_RENDER_BEFORE,
function(appConfig)
{
F2.log(appConfig);
}
);
APP_SCRIPT_LOAD_FAILED String final static
Identifies the app script load failed method for use in AppHandlers.on/off. When bound using F2.AppHandlers.on() the listener function passed will receive the following argument(s): ( appConfig, scriptInfo )
Example:
var _token = F2.AppHandlers.getToken(); F2.AppHandlers.on( _token, F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED, function(appConfig, scriptInfo) { F2.log(appConfig.appId); } );