New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-native-notification

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-native-notification - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

62

index.js
// Notification object
var Notification = window.Notification || window.webkitNotification
const onerror = function onerror (event) {
}
const onclick = function onclick (event) {
event.preventDefault()
window.focus()
event.target.close()
}
const onclose = function onclose (event) {
}
const onshow = function onshow (event) {
}
const defaultEvents = {
onerror: onerror,
onclick: onclick,
onclose: onclose,
onshow: onshow
}
// Plugin

@@ -21,3 +43,8 @@ const VueNativeNotification = {

// Show function
var show = function (title, opts) {
var show = function (title, opts, {
onerror = defaultEvents.onerror,
onclick = defaultEvents.onclick,
onclose = defaultEvents.onclose,
onshow = defaultEvents.onshow
}) {
return Promise.resolve()

@@ -39,3 +66,34 @@ .then(function () {

// Create Notification object
return new Notification(title, opts)
const notification = new Notification(title, opts)
const bindOnError = function (event) {
'use strict'
defaultEvents.onerror(event)
onerror(event)
}
const bindOnClick = function (event) {
'use strict'
defaultEvents.onclick(event)
onclick(event)
}
const bindOnClose = function (event) {
'use strict'
defaultEvents.onclose(event)
onclose(event)
}
const bindOnShow = function (event) {
'use strict'
defaultEvents.onshow(event)
onshow(event)
}
notification.onerror = bindOnError
notification.onclick = bindOnClick
notification.onclose = bindOnClose
notification.onshow = bindOnShow
return notification
})

@@ -42,0 +100,0 @@ }

2

package.json
{
"name": "vue-native-notification",
"version": "1.0.0",
"version": "1.0.1",
"description": "Vue.js plugin for native notifications",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -20,3 +20,3 @@ # vue-native-notification

Vue.use(VueNativeNotification, {
// Automatic permiossion request before
// Automatic permission request before
// showing notification (default: true)

@@ -67,2 +67,2 @@ requestOnNotify: true

[MIT](LICENSE.md)
[MIT](LICENSE.md)

@@ -1,1 +0,1 @@

(function e(n,t,i){function r(u,f){if(!t[u]){if(!n[u]){var s=typeof require=="function"&&require;if(!f&&s)return s(u,!0);if(o)return o(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var c=t[u]={exports:{}};n[u][0].call(c.exports,function(e){var t=n[u][1][e];return r(t?t:e)},c,c.exports,e,n,t,i)}return t[u].exports}var o=typeof require=="function"&&require;for(var u=0;u<i.length;u++)r(i[u]);return r})({1:[function(e,n,t){"use strict";Object.defineProperty(t,"__esModule",{value:true});var i=window.Notification||window.webkitNotification;var r={install:function e(n,t){t=t||{};t.requestOnNotify=t.requestOnNotify||true;n.notification={};n.prototype.$notification={};var r=function e(){return i.requestPermission()};n.notification.requestPermission=r;n.prototype.$notification.requestPermission=r;var o=function e(n,o){return Promise.resolve().then(function(){if(t.requestOnNotify&&i.permission!=="granted"){return r()}return i.permission}).then(function(e){if(e==="denied"){return new Error("No permission to show notification")}return new i(n,o)})};n.notification.show=o;n.prototype.$notification.show=o}};if(typeof window!=="undefined"&&window.Vue){window.Vue.use(r)}t.default=r},{}]},{},[1]);
(function n(o,r,e){function i(u,c){if(!r[u]){if(!o[u]){var f=typeof require=="function"&&require;if(!c&&f)return f(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 c=function n(o){};var f={onerror:i,onclick:t,onclose:u,onshow:c};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 c=u.onerror,s=c===undefined?f.onerror:c,a=u.onclick,d=a===undefined?f.onclick:a,w=u.onclose,v=w===undefined?f.onclose:w,l=u.onshow,p=l===undefined?f.onshow: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";f.onerror(o);s(o)};var u=function n(o){"use strict";f.onclick(o);d(o)};var c=function n(o){"use strict";f.onclose(o);v(o)};var a=function n(o){"use strict";f.onshow(o);p(o)};r.onerror=i;r.onclick=u;r.onclose=c;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]);
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc