From 889a2a7dc9514e916be64cff0f1f0236a123bbf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Man=CC=83anes?= Date: Tue, 7 Aug 2018 16:38:33 +0200 Subject: [PATCH] Custom events fixed Custom events fixed --- index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 18a5799..960c530 100644 --- a/index.js +++ b/index.js @@ -45,10 +45,10 @@ const VueNativeNotification = { // Show function var show = function (title, opts, e) { - e.onerror = function () { } - e.onclick = function () { } - e.onclose = function () { } - e.onshow = function () { } + if (!e.onerror) e.onerror = function () { } + if (!e.onclick) e.onclick = function () { } + if (!e.onclose) e.onclose = function () { } + if (!e.onshow) e.onshow = function () { } return Promise.resolve() .then(function () { if (options.requestOnNotify && Notification.permission !== 'granted') { @@ -68,25 +68,25 @@ const VueNativeNotification = { const bindOnError = function (event) { 'use strict' defaultEvents.onerror(event) - onerror() + e.onerror(event) } const bindOnClick = function (event) { 'use strict' defaultEvents.onclick(event) - onclick() + e.onclick(event) } const bindOnClose = function (event) { 'use strict' defaultEvents.onclose(event) - onclose() + e.onclose(event) } const bindOnShow = function (event) { 'use strict' defaultEvents.onshow(event) - onshow() + e.onshow(event) } // Create Notification object