How to inherit Owl.js Listener?

Viewed 359

I am trying to inherit/override listener of Point of Sale's ProductScreen. Owl.js is new for me I Spend many hours but can't find any solution.

Here is the code of listener event of point of sale module

useListener('click-product', this._clickProduct);

async _clickProduct(event) {
            // base code
        }

So basically I create extended module and need to override the method _clickProduct so I can do my custom stuff.

Thanks.

1 Answers

I found a way to inherit method

const ProductScreen = require('point_of_sale.ProductScreen');
const MyProductScreen = ProductScreen => class extends ProductScreen {

    async _clickProduct(event) {
        return super._clickProduct(...arguments);
    }

}
Related