Event Callback APIThe functions here allow developers access to the main events that occur in the ICEfaces client-side bridge. This API complements the existing API that's available in JSF 2 that allows the developer to register callbacks for general event and error handling. The ICEfaces API is designed in much the same way as the JSF API. Callback functions are registered that allow the developer to tap into several types of client events that are specific to ICEfaces. The following Event Callback APIs are available:
ice.onAfterUpdate(callback)Accepts a reference to a callback function. The callback function will be invoked after the updates are applied to the DOM. Usage: var postUpdateHandler = function(updates) { ... }; ice.onAfterUpdate(postUpdateHandler); Parameters:
ice.onBeforeSessionExpiry(callback)Accepts a reference to a callback function. The callback function will be invoked before the HTTP session will be expired. How much earlier the callback will be invoked is defined in warnBeforeSessionExpiryInterval context parameter. Usage: var beforeSessionExpiryHandler = function() { ... }; ice.onBeforeSessionExpiry(beforeSessionExpiryHandler); ice.onBeforeSubmit(callback)Accepts a reference to a callback function. The callback function will be invoked just before the form submit request is issued. Usage: var paramHandler = function(source, userInitiated) { ... }; ice.onBeforeSubmit(paramHandler); Parameters:
ice.onBeforeUpdate(callback)Accepts a reference to a callback function. The callback function will be invoked before the updates are applied to the DOM. Usage: var preUpdateHandler = function(updates) { ... }; ice.onBeforeUpdate(preUpdateHandler); Parameters:
ice.onElementRemove(elementID, callback)Accepts the ID of the element to be monitored for removal and a reference to a callback function. The callback function will be invoked when the element with the specified ID is removed from the document. Usage: var callback = function() { ... }; ice.onElementRemove(elementID, callback); Parameters:
ice.onElementUpdate(elementID, callback)Accepts the ID of the element to be monitored for update or removal, and a reference to a callback function. The callback function will be invoked when the element with the specified ID is removed from the document. The callback is invoked before the update is applied so that it has a chance to work with objects that are about to be removed or replaced in the document. Usage: var callback = function() { ... }; ice.onElementUpdate(elementID, callback); Parameters:
ice.onLoad(callback)Accepts a reference to a callback function. The callback function will be invoked when the DOM document finished loading. This registration function allows the registration of multiple callbacks without the danger of callback overwriting (unlike the native windown.onload property).
var callback = function() { ... }; ice.onLoad(callback); Parameters:
ice.onNetworkError(callback)Accepts a reference to a callback function. The callback function will be invoked when a network error is detected by the browser during a request-response. Usage: var networkErrorHandler = function(statusCode, errorDescription) { ... }; ice.onNetworkError(networkErrorHandler); Parameters:
ice.onServerError(callback)Accepts a reference to a callback function. The callback function will be invoked when a server error is received by the browser from a JSF form submit. Usage: var serverErrorHandler = function(statusCode, responseText, responseDOM) { ... }; ice.onServerError(serverErrorHandler); Parameters:
ice.onUnload(callback)Accepts a reference to a callback function. The callback function will be invoked when the DOM document is unloaded. This registration function allows the registration of multiple callbacks without the danger of callback overwriting (unlike the native windown.onunload property).
var callback = function() { ... }; ice.onUnload(callback); Parameters:
ice.onBeforeUnload(callback)Accepts a reference to a callback function. The callback function will be invoked before the DOM document is unloaded. This registration function allows the registration of multiple callbacks without the danger of callback overwriting (unlike the native windown.onbeforeunload property).
var callback = function() { ... }; ice.onBeforeUnload(callback); Parameters:
ice.onUserInactivity(interval, idleCallback, activeCallback)(Since ICEfaces 3.4) Accepts the registration of callbacks that can be used to monitor user's activity within a page. When the user is idle (no keyboard or mouse events triggered) for more than the specified interval the idleCallback will be invoked. In case the user resumes activity after the interval has elapsed the activeCallback will be invoked.
var idleCallback = function() { ...//display alert and/or postback form data }; var activeCallback = function() { ...//hide alert }; ice.onUserInactivity(interval, idleCallback, activeCallback); ...//or optionally var userActiveEvents = ['click', 'keydown']; ice.onUserInactivity(interval, idleCallback, activeCallback, userActiveEvents); Parameters:
|
Event Callback API
© Copyright 2021 ICEsoft Technologies Canada Corp.