vue-native-notification
Advanced tools
Comparing version 1.0.2 to 1.0.3
34
index.js
@@ -47,8 +47,7 @@ // Notification object | ||
// Show function | ||
var show = function (title, opts, { | ||
onerror = function () { }, | ||
onclick = function () { }, | ||
onclose = function () { }, | ||
onshow = function () { } | ||
}) { | ||
var show = function (title, opts, e) { | ||
e.onerror = function () { } | ||
e.onclick = function () { } | ||
e.onclose = function () { } | ||
e.onshow = function () { } | ||
return Promise.resolve() | ||
@@ -69,4 +68,2 @@ .then(function () { | ||
// Create Notification object | ||
const notification = new Notification(title, opts) | ||
@@ -97,8 +94,19 @@ const bindOnError = function (event) { | ||
notification.onerror = bindOnError | ||
notification.onclick = bindOnClick | ||
notification.onclose = bindOnClose | ||
notification.onshow = bindOnShow | ||
// Create Notification object | ||
try { | ||
const notification = new Notification(title, opts) | ||
return notification | ||
notification.onerror = bindOnError | ||
notification.onclick = bindOnClick | ||
notification.onclose = bindOnClose | ||
notification.onshow = bindOnShow | ||
return notification | ||
} catch (e) { | ||
if (e.name !== 'TypeError') | ||
return e | ||
return navigator.serviceWorker.ready.then(reg => reg.showNotification(title, opts)) | ||
.then(bindOnShow, bindOnError) | ||
} | ||
}) | ||
@@ -105,0 +113,0 @@ } |
{ | ||
"name": "vue-native-notification", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Vue.js plugin for native notifications", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,1 +0,1 @@ | ||
(function n(o,r,e){function i(u,f){if(!r[u]){if(!o[u]){var c=typeof require=="function"&&require;if(!f&&c)return c(u,!0);if(t)return t(u,!0);var s=new Error("Cannot find module '"+u+"'");throw s.code="MODULE_NOT_FOUND",s}var a=r[u]={exports:{}};o[u][0].call(a.exports,function(n){var r=o[u][1][n];return i(r?r:n)},a,a.exports,n,o,r,e)}return r[u].exports}var t=typeof require=="function"&&require;for(var u=0;u<e.length;u++)i(e[u]);return i})({1:[function(n,o,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var e=window.Notification||window.webkitNotification;var i=function n(o){};var t=function n(o){o.preventDefault();window.focus();o.target.close()};var u=function n(o){};var f=function n(o){};var c={onerror:i,onclick:t,onclose:u,onshow:f};var s={install:function n(o,r){r=r||{};r.requestOnNotify=r.requestOnNotify||true;o.notification={};o.prototype.$notification={};var i=function n(){return e.requestPermission()};o.notification.requestPermission=i;o.prototype.$notification.requestPermission=i;var t=function n(o,t,u){var f=u.onerror,s=f===undefined?function(){}:f,a=u.onclick,d=a===undefined?function(){}:a,v=u.onclose,w=v===undefined?function(){}:v,l=u.onshow,p=l===undefined?function(){}:l;return Promise.resolve().then(function(){if(r.requestOnNotify&&e.permission!=="granted"){return i()}return e.permission}).then(function(n){if(n==="denied"){return new Error("No permission to show notification")}var r=new e(o,t);var i=function n(o){"use strict";c.onerror(o);s()};var u=function n(o){"use strict";c.onclick(o);d()};var f=function n(o){"use strict";c.onclose(o);w()};var a=function n(o){"use strict";c.onshow(o);p()};r.onerror=i;r.onclick=u;r.onclose=f;r.onshow=a;return r})};o.notification.show=t;o.prototype.$notification.show=t}};if(typeof window!=="undefined"&&window.Vue){window.Vue.use(s)}r.default=s},{}]},{},[1]); | ||
(function(){function a(i,u,c){function f(r,n){if(!u[r]){if(!i[r]){var o="function"==typeof require&&require;if(!n&&o)return o(r,!0);if(s)return s(r,!0);var t=new Error("Cannot find module '"+r+"'");throw t.code="MODULE_NOT_FOUND",t}var e=u[r]={exports:{}};i[r][0].call(e.exports,function(n){var o=i[r][1][n];return f(o||n)},e,e.exports,a,i,u,c)}return u[r].exports}for(var s="function"==typeof require&&require,n=0;n<c.length;n++)f(c[n]);return f}return a})()({1:[function(n,o,r){"use strict";Object.defineProperty(r,"__esModule",{value:true});var f=window.Notification||window.webkitNotification;var s=function n(o){};var a=function n(o){o.preventDefault();window.focus();o.target.close()};var w=function n(o){};var v=function n(o){};var l={onerror:s,onclick:a,onclose:w,onshow:v};var t={install:function n(o,r){r=r||{};r.requestOnNotify=r.requestOnNotify||true;o.notification={};o.prototype.$notification={};var t=function n(){return f.requestPermission()};o.notification.requestPermission=t;o.prototype.$notification.requestPermission=t;var e=function n(u,c,o){o.onerror=function(){};o.onclick=function(){};o.onclose=function(){};o.onshow=function(){};return Promise.resolve().then(function(){if(r.requestOnNotify&&f.permission!=="granted"){return t()}return f.permission}).then(function(n){if(n==="denied"){return new Error("No permission to show notification")}var o=function n(o){"use strict";l.onerror(o);s()};var r=function n(o){"use strict";l.onclick(o);a()};var t=function n(o){"use strict";l.onclose(o);w()};var e=function n(o){"use strict";l.onshow(o);v()};try{var i=new f(u,c);i.onerror=o;i.onclick=r;i.onclose=t;i.onshow=e;return i}catch(n){if(n.name!=="TypeError")return n;return navigator.serviceWorker.ready.then(function(n){return n.showNotification(u,c)}).then(e,o)}})};o.notification.show=e;o.prototype.$notification.show=e}};if(typeof window!=="undefined"&&window.Vue){window.Vue.use(t)}r.default=t},{}]},{},[1]); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
97559
109
1