Skip to content

Commit

Permalink
related PrestaShop#34599 and PrestaShop#35970 - test custom events in…
Browse files Browse the repository at this point in the history
…stead eventEmitter instance
  • Loading branch information
mattgoud committed Jul 9, 2024
1 parent d113ebe commit fc70bf7
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ export default class ProductManager {
*
* @private
*/

private onProductSearch(): void {
EventEmitter.on(eventMap.productSearched, (response) => {
this.products = response.products;
document.addEventListener(eventMap.productSearched, (event: any) => {
this.products = event.detail.products;
this.productRenderer.renderSearchResults(this.products);
this.selectFirstResult();
});
Expand Down Expand Up @@ -267,7 +268,7 @@ export default class ProductManager {

$searchRequest
.then((response) => {
EventEmitter.emit(eventMap.productSearched, response);
document.dispatchEvent(new CustomEvent(eventMap.productSearched, {detail: response}));
})
.catch((response: JQuery.jqXHR) => {
if (response.statusText === 'abort') {
Expand Down

0 comments on commit fc70bf7

Please sign in to comment.