Question

How to unsubscribe to message when closing/cancelling/discarding the record page

Hi Community,

 

We have this functionality that we are subscribing to message on load of record page. How we can unsubscribe once we close/cancel/discard the record page.



Below is the code how we subscribe during record on load.



    init: function() {

                this.callParent(arguments);

                this.subscriptionFunction();

                

            },

            

            subscriptionFunction: function() {

                Terrasoft.ServerChannel.on(Terrasoft.EventName.ON_MESSAGE,

                this.onMyProcessMessage, this);

            },

Like 0

Like

2 comments

To unsubscribe from the message when the page is closed/canceled/etc, add the following: 

destroy: function() {
    Terrasoft.ServerChannel.un(Terrasoft.EventName.ON_MESSAGE, this.onMyProcessMessage, this);
    this.callParent(arguments);
}

Ryan

Ryan Farley,

Thank you Ryan.

Show all comments