CanvasLifecycleHandler Interface
Implement this interface to control
context information and add custom behavior during the application
render phase.
Namespace
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.
1public with sharing class MyCanvasListener
2implements Canvas.CanvasLifecycleHandler{
3 public Set<Canvas.ContextTypeEnum> excludeContextTypes(){
4 Set<Canvas.ContextTypeEnum> excluded = new Set<Canvas.ContextTypeEnum>();
5 excluded.add(Canvas.ContextTypeEnum.ORGANIZATION);
6 return excluded;
7 }
8
9 public void onRender(Canvas.RenderContext renderContext){
10 System.debug('Canvas lifecycle called.');
11 }
12}