From 5658a0dfe82777a1e96a553dda8e7f6b8da26731 Mon Sep 17 00:00:00 2001 From: Charles Loder Date: Tue, 19 Mar 2024 12:04:16 -0400 Subject: [PATCH] Adds optional click event param to onClick opt --- src/toastify-es.js | 4 ++-- src/toastify.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/toastify-es.js b/src/toastify-es.js index 784cf59..6517631 100644 --- a/src/toastify-es.js +++ b/src/toastify-es.js @@ -50,7 +50,7 @@ class Toastify { avatar: "", className: "", stopOnFocus: true, - onClick: function() {}, + onClick: function(event = null) {}, offset: { x: 0, y: 0 }, escapeMarkup: true, ariaLive: "polite", @@ -320,7 +320,7 @@ class Toastify { "click", (event) => { event.stopPropagation(); - this.options.onClick(); + this.options.onClick(event); } ); } diff --git a/src/toastify.js b/src/toastify.js index 5d9659c..d4a74b1 100644 --- a/src/toastify.js +++ b/src/toastify.js @@ -39,7 +39,7 @@ avatar: "", className: "", stopOnFocus: true, - onClick: function () { + onClick: function (event = null) { }, offset: {x: 0, y: 0}, escapeMarkup: true, @@ -242,7 +242,7 @@ "click", function(event) { event.stopPropagation(); - this.options.onClick(); + this.options.onClick(event); }.bind(this) ); }