subscribe

Callable

  • subscribe(event: string, handler: function ) : void
  • Links an event with a handler function. PostMessage.Events object contains the supported events.

    example

    The following snippet subscribes to the Events.BoundsNotification event and outputs the event arguments to the console:

    var editor = null;
    CustomersCanvas.IframeApi.loadEditor(iframe, productDefinition)
        .then(function(e) {
            editor = e;
            editor.subscribe(CustomersCanvas.IframeApi.PostMessage.Events.BoundsNotification, 
                function(args) 
                { 
                    console.log("BoundsNotification fired."); 
                    console.log(JSON.stringify(args, null, 4)); 
                })
        });
    

    Parameters

    • event: string

      The event to link the handler function with.

    • handler: function

      The handler function to link with the given event.

        • ( ...args: any [] ) : void
        • Parameters

          • Rest ...args: any []

          Returns void

    Returns void