CanvasLifecycleHandler Interface

Implement this interface to control context information and add custom behavior during the application render phase.

Namespace

Canvas

Usage

Use this interface to specify what canvas context information is provided to your app by implementing the excludeContextTypes() method. Use this interface to call custom code when the app is rendered by implementing the onRender() method.

If you provide an implementation of this interface, you must implement excludeContextTypes() and onRender().

Example Implementation

The following example shows a simple implementation of CanvasLifecycleHandler that specifies that organization context information will be excluded and prints a debug message when the app is rendered.
public class MyCanvasListener 
implements Canvas.CanvasLifecycleHandler{
    public Set<Canvas.ContextTypeEnum> excludeContextTypes(){
        Set<Canvas.ContextTypeEnum> excluded = new Set<Canvas.ContextTypeEnum>();
        excluded.add(Canvas.ContextTypeEnum.ORGANIZATION);
        return excluded;
    }
    
    public void onRender(Canvas.RenderContext renderContext){
        System.debug('Canvas lifecycle called.');
    }
}
Previous
Next