-1

There is a widget in the POS(point of sale) called PaymentScreenWidget and inside that there's a customer_changed method which is called when the customer is changed.

Suppose that I want to call a method after this method is called then how can I do this without interfering with this code?

Interfering with this code leaves a lot of trouble in many case so are there any ways to achieve this?

I want to append some text to it but since there are many module who try to change those code or override it I want to avoid doing it and try to call my method after that method has been called.

Rajesh Paudel
  • 1,117
  • 8
  • 19

1 Answers1

0

You'll have to do some code instrumentation. For example,

let old_customer_changed = customer_changed;
customer_changed = function(){
 // my awesome code
 old_customer_changed();
}

You'll have to implement similar thing in whatever modules you are using.

T J
  • 42,762
  • 13
  • 83
  • 138