Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-notifications

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-notifications - npm Package Compare versions

Comparing version 0.7.3 to 0.7.4

yarn.lock

2

bower.json
{
"name": "vue-notifications",
"version": "0.7.3",
"version": "0.7.4",
"description": "Vuejs notifications",

@@ -5,0 +5,0 @@ "main": "dist/vue-notifications.js",

@@ -90,5 +90,4 @@ ;(function(root, factory) {

* @param {String} timeout
* @param {String} title
* @param {String} message
* @param {Function} computed // TODO (S.Panfilov) or not fn?
* @param {Function} watch
* @param {String} debugMsg

@@ -103,5 +102,4 @@ * @param {Function} cb

timeout = _ref2.timeout,
title = _ref2.title,
message = _ref2.message,
computed = _ref2.computed,
watch = _ref2.watch,
debugMsg = _ref2.debugMsg,

@@ -114,21 +112,19 @@ cb = _ref2.cb;

var msg = message;
if (title) msg = title + ': ' + msg;
elem.innerText = msg;
if (timeout && !computed) {
elem.innerText = message;
if (timeout && !watch) {
setTimeout(function () {
innerMethods.clearFn.call(vueApp, elem);
}, timeout);
} else {}
// TODO (S.Panfilov) Computed property doesn't work yet
// const interval = setInterval(() => {
// console.info(computed)
// if (!computed) clearInterval(interval)
// }, 50)
} else {
(function () {
var interval = setInterval(function () {
if (watch && !watch()) {
clearInterval(interval);
innerMethods.clearFn.call(innerMethods, elem);
}
}, 50);
})();
}
// TODO (S.Panfilov) BUG: Weird behaviour: cb calls 2 times
console.warn(this);
if (cb) {

@@ -141,3 +137,3 @@ // TODO (S.Panfilov) bug here

return msg;
return message;
},

@@ -154,9 +150,13 @@

var keepFnFields = ['cb', 'watch'];
Object.keys(config).forEach(function (field) {
if (field !== 'cb') {
result[field] = typeof config[field] === 'function' ? config[field].call(vueApp) : config[field];
} else {
console.info(vueApp);
result[field] = config[field].bind(vueApp);
}
keepFnFields.forEach(function (fnField) {
if (field === fnField) {
result[field] = config[field].bind(vueApp);
} else {
result[field] = typeof config[field] === 'function' ? config[field].call(vueApp) : config[field];
}
});
});

@@ -217,3 +217,2 @@

// TODO (S.Panfilov) not sure - throw error here or just warn
// if (options.methods[name]) throw console.error(MESSAGES.methodNameConflict + name)
console.error(MESSAGES.methodNameConflict + name);

@@ -220,0 +219,0 @@ } else {

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

!function(e,n){"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?module.exports=n():e.VueNotifications=n()}(this,function(){"use strict";var e="VueNotifications",n="vue-notifications",t="notifications",o={error:"error",warn:"warn",info:"info",success:"success"},i={evangelion:1,ghostInTheShell:2},s={alreadyInstalled:e+": plugin already installed",methodNameConflict:e+": names conflict - "},r={getVersion:function(e){var n=e.version.match(/(\d+)/g);return{major:+n[0],regular:+n[1],minor:+n[2]}},showInConsole:function(e,n,t){n===t.error?console.error(e):n===t.warn?console.warn(e):n===t.success?console.info(e):console.log(e)},showDefaultMessage:function(e,n){var t=e.type,i=e.message,s=e.title,a=e.debugMsg,c="Title: "+s+", Message: "+i+", DebugMsg: "+a+", type: "+t;return r.showInConsole(c,t,o),c},clearFn:function(e){e.innerText=""},showInlineMessage:function(e,n){var t=e.id,i=e.type,s=e.timeout,a=e.title,c=e.message,l=e.computed,u=e.debugMsg,f=e.cb;u&&r.showInConsole(u,i,o);var d=document.getElementById(t),h=c;return a&&(h=a+": "+h),d.innerText=h,s&&!l&&setTimeout(function(){r.clearFn.call(n,d)},s),console.warn(this),f&&f.call(n,d,function(){return r.clearFn.call(r,d)}),h},getValues:function(e,n){var t={};return Object.keys(n).forEach(function(o){"cb"!==o?t[o]="function"==typeof n[o]?n[o].call(e):n[o]:(console.info(e),t[o]=n[o].bind(e))}),t},showMessage:function(e,n,t){var o=r.getValues(t,e),i=!!o.id;if(i)r.showInlineMessage(o,t);else{var s=n&&n[o.type],a=s?n[o.type]:r.showDefaultMessage;a(o,t)}if(e.cb)return e.cb()},addMethods:function(e,n,t){Object.keys(n).forEach(function(o){e[n[o]]=function(e){return e.type=n[o],r.showMessage(e,t)}})},setMethod:function(e,n,t,o){t.methods||(t.methods={}),t.methods[n]?console.error(s.methodNameConflict+n):t.methods[n]=r.makeMethod(e,n,t,o)},makeMethod:function(e,n,t,o){return function(i){var s={};return Object.assign(s,a.config),Object.assign(s,t[a.propertyName][n]),Object.assign(s,i),r.showMessage(s,o,e)}},initVueNotificationPlugin:function(e,t,o){t&&(Object.keys(t).forEach(function(n){r.setMethod(e,n,e.$options,o)}),e.$emit(n+"-initiated"))}},a={type:o,propertyName:t,config:{type:o.info,timeout:3e3},installed:!1,install:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={},o=void 0;if(this.installed)throw console.error(s.alreadyInstalled);r.getVersion(e).major===i.evangelion&&(o="init"),r.getVersion(e).major===i.ghostInTheShell&&(o="beforeCreate"),t[o]=function(){var e=this,t=this.$options,o=t[a.propertyName];r.initVueNotificationPlugin(e,o,n)},e.mixin(t),r.addMethods(this,this.type,n),this.installed=!0}};return"undefined"!=typeof window&&window.Vue&&window.Vue.use(a),a});
!function(e,n){"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?module.exports=n():e.VueNotifications=n()}(this,function(){"use strict";var e="VueNotifications",n="vue-notifications",t="notifications",o={error:"error",warn:"warn",info:"info",success:"success"},i={evangelion:1,ghostInTheShell:2},s={alreadyInstalled:e+": plugin already installed",methodNameConflict:e+": names conflict - "},r={getVersion:function(e){var n=e.version.match(/(\d+)/g);return{major:+n[0],regular:+n[1],minor:+n[2]}},showInConsole:function(e,n,t){n===t.error?console.error(e):n===t.warn?console.warn(e):n===t.success?console.info(e):console.log(e)},showDefaultMessage:function(e,n){var t=e.type,i=e.message,s=e.title,a=e.debugMsg,c="Title: "+s+", Message: "+i+", DebugMsg: "+a+", type: "+t;return r.showInConsole(c,t,o),c},clearFn:function(e){e.innerText=""},showInlineMessage:function(e,n){var t=e.id,i=e.type,s=e.timeout,a=e.message,c=e.watch,l=e.debugMsg,u=e.cb;l&&r.showInConsole(l,i,o);var f=document.getElementById(t);return f.innerText=a,s&&!c?setTimeout(function(){r.clearFn.call(n,f)},s):!function(){var e=setInterval(function(){c&&!c()&&(clearInterval(e),r.clearFn.call(r,f))},50)}(),u&&u.call(n,f,function(){return r.clearFn.call(r,f)}),a},getValues:function(e,n){var t={},o=["cb","watch"];return Object.keys(n).forEach(function(i){o.forEach(function(o){i===o?t[i]=n[i].bind(e):t[i]="function"==typeof n[i]?n[i].call(e):n[i]})}),t},showMessage:function(e,n,t){var o=r.getValues(t,e),i=!!o.id;if(i)r.showInlineMessage(o,t);else{var s=n&&n[o.type],a=s?n[o.type]:r.showDefaultMessage;a(o,t)}if(e.cb)return e.cb()},addMethods:function(e,n,t){Object.keys(n).forEach(function(o){e[n[o]]=function(e){return e.type=n[o],r.showMessage(e,t)}})},setMethod:function(e,n,t,o){t.methods||(t.methods={}),t.methods[n]?console.error(s.methodNameConflict+n):t.methods[n]=r.makeMethod(e,n,t,o)},makeMethod:function(e,n,t,o){return function(i){var s={};return Object.assign(s,a.config),Object.assign(s,t[a.propertyName][n]),Object.assign(s,i),r.showMessage(s,o,e)}},initVueNotificationPlugin:function(e,t,o){t&&(Object.keys(t).forEach(function(n){r.setMethod(e,n,e.$options,o)}),e.$emit(n+"-initiated"))}},a={type:o,propertyName:t,config:{type:o.info,timeout:3e3},installed:!1,install:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={},o=void 0;if(this.installed)throw console.error(s.alreadyInstalled);r.getVersion(e).major===i.evangelion&&(o="init"),r.getVersion(e).major===i.ghostInTheShell&&(o="beforeCreate"),t[o]=function(){var e=this,t=this.$options,o=t[a.propertyName];r.initVueNotificationPlugin(e,o,n)},e.mixin(t),r.addMethods(this,this.type,n),this.installed=!0}};return"undefined"!=typeof window&&window.Vue&&window.Vue.use(a),a});
//# sourceMappingURL=vue-notifications.es5.min.js.map

@@ -73,5 +73,4 @@ const PLUGIN_NAME = 'VueNotifications'

* @param {String} timeout
* @param {String} title
* @param {String} message
* @param {Function} computed // TODO (S.Panfilov) or not fn?
* @param {Function} watch
* @param {String} debugMsg

@@ -82,3 +81,3 @@ * @param {Function} cb

*/
showInlineMessage ({ id, type, timeout, title, message, computed, debugMsg, cb }, vueApp) {
showInlineMessage ({ id, type, timeout, message, watch, debugMsg, cb }, vueApp) {
// TODO (S.Panfilov) handle class add and remove here

@@ -88,8 +87,5 @@ if (debugMsg) innerMethods.showInConsole(debugMsg, type, TYPE)

let msg = message
if (title) msg = `${title}: ${msg}`
elem.innerText = msg
if (timeout && !computed) {
elem.innerText = message
if (timeout && !watch) {
setTimeout(() => {

@@ -99,11 +95,11 @@ innerMethods.clearFn.call(vueApp, elem)

} else {
// TODO (S.Panfilov) Computed property doesn't work yet
// const interval = setInterval(() => {
// console.info(computed)
// if (!computed) clearInterval(interval)
// }, 50)
const interval = setInterval(() => {
if (watch && !watch()) {
clearInterval(interval)
innerMethods.clearFn.call(innerMethods, elem)
}
}, 50)
}
// TODO (S.Panfilov) BUG: Weird behaviour: cb calls 2 times
console.warn(this)
if (cb) {

@@ -114,3 +110,3 @@ // TODO (S.Panfilov) bug here

return msg
return message
},

@@ -126,9 +122,14 @@

const keepFnFields = ['cb', 'watch']
Object.keys(config).forEach(field => {
if (field !== 'cb') {
result[field] = (typeof config[field] === 'function') ? config[field].call(vueApp) : config[field]
} else {
console.info(vueApp)
result[field] = config[field].bind(vueApp)
}
keepFnFields.forEach(fnField => {
if (field === fnField) {
result[field] = config[field].bind(vueApp)
} else {
result[field] = (typeof config[field] === 'function') ? config[field].call(vueApp) : config[field]
}
})
})

@@ -144,3 +145,4 @@

*/
showMessage (config, options, vueApp) {
showMessage(config, options, vueApp)
{
const valuesObj = innerMethods.getValues(vueApp, config)

@@ -158,3 +160,4 @@ const isLinkedToElem = !!valuesObj.id

if (config.cb) return config.cb()
},
}
,

@@ -167,3 +170,4 @@ /**

* */
addMethods (targetObj, typesObj, options) {
addMethods(targetObj, typesObj, options)
{
Object.keys(typesObj).forEach(v => {

@@ -176,3 +180,4 @@ targetObj[typesObj[v]] = function (config) {

})
},
}
,

@@ -185,3 +190,4 @@ /**

*/
setMethod (vueApp, name, options, pluginOptions) {
setMethod(vueApp, name, options, pluginOptions)
{
if (!options.methods) options.methods = {}

@@ -191,3 +197,2 @@

// TODO (S.Panfilov) not sure - throw error here or just warn
// if (options.methods[name]) throw console.error(MESSAGES.methodNameConflict + name)
console.error(MESSAGES.methodNameConflict + name)

@@ -197,3 +202,4 @@ } else {

}
},
}
,

@@ -207,3 +213,4 @@ /**

*/
makeMethod (vueApp, configName, options, pluginOptions) {
makeMethod(vueApp, configName, options, pluginOptions)
{
return function (config) {

@@ -217,3 +224,4 @@ const newConfig = {}

}
},
}
,
/**

@@ -224,3 +232,4 @@ * @param {Object} vueApp

*/
initVueNotificationPlugin (vueApp, notifications, pluginOptions) {
initVueNotificationPlugin(vueApp, notifications, pluginOptions)
{
if (!notifications) return

@@ -272,5 +281,6 @@ Object.keys(notifications).forEach(name => {

if (typeof window !== 'undefined' && window.Vue) {
if (typeof window !== 'undefined' && window.Vue
) {
window.Vue.use(VueNotifications)
}

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

'use strict';var PLUGIN_NAME='VueNotifications',PACKAGE_NAME='vue-notifications',PROPERTY_NAME='notifications',TYPE={error:'error',warn:'warn',info:'info',success:'success'},VUE_VERSION={evangelion:1,ghostInTheShell:2},MESSAGES={alreadyInstalled:PLUGIN_NAME+': plugin already installed',methodNameConflict:PLUGIN_NAME+': names conflict - '},innerMethods={getVersion:function getVersion(a){var b=a.version.match(/(\d+)/g);return{major:+b[0],regular:+b[1],minor:+b[2]}},showInConsole:function showInConsole(a,b,c){b===c.error?console.error(a):b===c.warn?console.warn(a):b===c.success?console.info(a):console.log(a)},showDefaultMessage:function showDefaultMessage(_ref){var a=_ref.type,b=_ref.message,c=_ref.title,d=_ref.debugMsg,e='Title: '+c+', Message: '+b+', DebugMsg: '+d+', type: '+a;return innerMethods.showInConsole(e,a,TYPE),e},clearFn:function clearFn(a){a.innerText=''},showInlineMessage:function showInlineMessage(_ref2,i){var a=_ref2.id,b=_ref2.type,c=_ref2.timeout,d=_ref2.title,e=_ref2.message,f=_ref2.computed,g=_ref2.debugMsg,h=_ref2.cb;g&&innerMethods.showInConsole(g,b,TYPE);var j=document.getElementById(a),k=e;return d&&(k=d+': '+k),j.innerText=k,c&&!f&&setTimeout(function(){innerMethods.clearFn.call(i,j)},c),console.warn(this),h&&h.call(i,j,function(){return innerMethods.clearFn.call(innerMethods,j)}),k},getValues:function getValues(a,b){var c={};return Object.keys(b).forEach(function(d){'cb'===d?(console.info(a),c[d]=b[d].bind(a)):c[d]='function'==typeof b[d]?b[d].call(a):b[d]}),c},showMessage:function showMessage(a,b,c){var d=innerMethods.getValues(c,a),e=!!d.id;if(e)innerMethods.showInlineMessage(d,c);else{var f=b&&b[d.type],g=f?b[d.type]:innerMethods.showDefaultMessage;g(d,c)}return a.cb?a.cb():void 0},addMethods:function addMethods(a,b,c){Object.keys(b).forEach(function(d){a[b[d]]=function(e){return e.type=b[d],innerMethods.showMessage(e,c)}})},setMethod:function setMethod(a,b,c,d){c.methods||(c.methods={}),c.methods[b]?console.error(MESSAGES.methodNameConflict+b):c.methods[b]=innerMethods.makeMethod(a,b,c,d)},makeMethod:function makeMethod(a,b,c,d){return function(e){var f={};return Object.assign(f,VueNotifications.config),Object.assign(f,c[VueNotifications.propertyName][b]),Object.assign(f,e),innerMethods.showMessage(f,d,a)}},initVueNotificationPlugin:function initVueNotificationPlugin(a,b,c){b&&(Object.keys(b).forEach(function(d){innerMethods.setMethod(a,d,a.$options,c)}),a.$emit(PACKAGE_NAME+'-initiated'))}},VueNotifications={type:TYPE,propertyName:PROPERTY_NAME,config:{type:TYPE.info,timeout:3000},installed:!1,install:function install(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c={},d=void 0;if(this.installed)throw console.error(MESSAGES.alreadyInstalled);innerMethods.getVersion(a).major===VUE_VERSION.evangelion&&(d='init'),innerMethods.getVersion(a).major===VUE_VERSION.ghostInTheShell&&(d='beforeCreate'),c[d]=function(){var e=this,f=this.$options,g=f[VueNotifications.propertyName];innerMethods.initVueNotificationPlugin(e,g,b)},a.mixin(c),innerMethods.addMethods(this,this.type,b),this.installed=!0}};'undefined'!=typeof window&&window.Vue&&window.Vue.use(VueNotifications);
'use strict';var PLUGIN_NAME='VueNotifications',PACKAGE_NAME='vue-notifications',PROPERTY_NAME='notifications',TYPE={error:'error',warn:'warn',info:'info',success:'success'},VUE_VERSION={evangelion:1,ghostInTheShell:2},MESSAGES={alreadyInstalled:PLUGIN_NAME+': plugin already installed',methodNameConflict:PLUGIN_NAME+': names conflict - '},innerMethods={getVersion:function getVersion(a){var b=a.version.match(/(\d+)/g);return{major:+b[0],regular:+b[1],minor:+b[2]}},showInConsole:function showInConsole(a,b,c){b===c.error?console.error(a):b===c.warn?console.warn(a):b===c.success?console.info(a):console.log(a)},showDefaultMessage:function showDefaultMessage(_ref){var a=_ref.type,b=_ref.message,c=_ref.title,d=_ref.debugMsg,e='Title: '+c+', Message: '+b+', DebugMsg: '+d+', type: '+a;return innerMethods.showInConsole(e,a,TYPE),e},clearFn:function clearFn(a){a.innerText=''},showInlineMessage:function showInlineMessage(_ref2,h){var a=_ref2.id,b=_ref2.type,c=_ref2.timeout,d=_ref2.message,e=_ref2.watch,f=_ref2.debugMsg,g=_ref2.cb;f&&innerMethods.showInConsole(f,b,TYPE);var i=document.getElementById(a);return i.innerText=d,c&&!e?setTimeout(function(){innerMethods.clearFn.call(h,i)},c):function(){var j=setInterval(function(){e&&!e()&&(clearInterval(j),innerMethods.clearFn.call(innerMethods,i))},50)}(),(g&&g.call(h,i,function(){return innerMethods.clearFn.call(innerMethods,i)}),d)},getValues:function getValues(a,b){var c={},d=['cb','watch'];return Object.keys(b).forEach(function(e){d.forEach(function(f){c[e]=e===f?b[e].bind(a):'function'==typeof b[e]?b[e].call(a):b[e]})}),c},showMessage:function showMessage(a,b,c){var d=innerMethods.getValues(c,a),e=!!d.id;if(e)innerMethods.showInlineMessage(d,c);else{var f=b&&b[d.type],g=f?b[d.type]:innerMethods.showDefaultMessage;g(d,c)}return a.cb?a.cb():void 0},addMethods:function addMethods(a,b,c){Object.keys(b).forEach(function(d){a[b[d]]=function(e){return e.type=b[d],innerMethods.showMessage(e,c)}})},setMethod:function setMethod(a,b,c,d){c.methods||(c.methods={}),c.methods[b]?console.error(MESSAGES.methodNameConflict+b):c.methods[b]=innerMethods.makeMethod(a,b,c,d)},makeMethod:function makeMethod(a,b,c,d){return function(e){var f={};return Object.assign(f,VueNotifications.config),Object.assign(f,c[VueNotifications.propertyName][b]),Object.assign(f,e),innerMethods.showMessage(f,d,a)}},initVueNotificationPlugin:function initVueNotificationPlugin(a,b,c){b&&(Object.keys(b).forEach(function(d){innerMethods.setMethod(a,d,a.$options,c)}),a.$emit(PACKAGE_NAME+'-initiated'))}},VueNotifications={type:TYPE,propertyName:PROPERTY_NAME,config:{type:TYPE.info,timeout:3000},installed:!1,install:function install(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c={},d=void 0;if(this.installed)throw console.error(MESSAGES.alreadyInstalled);innerMethods.getVersion(a).major===VUE_VERSION.evangelion&&(d='init'),innerMethods.getVersion(a).major===VUE_VERSION.ghostInTheShell&&(d='beforeCreate'),c[d]=function(){var e=this,f=this.$options,g=f[VueNotifications.propertyName];innerMethods.initVueNotificationPlugin(e,g,b)},a.mixin(c),innerMethods.addMethods(this,this.type,b),this.installed=!0}};'undefined'!=typeof window&&window.Vue&&window.Vue.use(VueNotifications);
{
"name": "vue-notifications",
"version": "0.7.3",
"version": "0.7.4",
"description": "Vuejs notifications",

@@ -52,3 +52,3 @@ "main": "dist/vue-notifications.es5.js",

"chai": "^3.5.0",
"eslint": "^3.7.1",
"eslint": "^3.10.1",
"eslint-config-standard": "^6.2.1",

@@ -83,4 +83,3 @@ "eslint-friendly-formatter": "^2.0.6",

},
"dependencies": {
}
"dependencies": {}
}

@@ -235,5 +235,8 @@ 'use strict'

const vueApp = {
}
_private.setMethod(name, options, pluginOptions)
expect(console.error).to.not.be.called
expect(_private.makeMethod).to.not.be.calledWith(name, options, pluginOptions)
expect(_private.makeMethod).to.not.be.calledWith(vueApp, name, options, pluginOptions)

@@ -240,0 +243,0 @@ console.error.restore()

### TODOs
| Filename | line # | TODO
|:------|:------:|:------
| main.js | 82 | @S.Panfilov handle class add and remove here
| main.js | 96 | @S.Panfilov Computed property doesn't work yet
| main.js | 103 | @S.Panfilov BUG: Weird behaviour: cb calls 2 times
| main.js | 106 | @S.Panfilov bug here
| main.js | 163 | @S.Panfilov fix 'vueApp' in param
| main.js | 179 | @S.Panfilov not sure - throw error here or just warn
| unit/main.spec.js | 280 | @S.Panfilov fix this test
| main.js | 81 | @S.Panfilov handle class add and remove here
| main.js | 100 | @S.Panfilov BUG: Weird behaviour: cb calls 2 times
| main.js | 102 | @S.Panfilov bug here
| main.js | 167 | @S.Panfilov fix 'vueApp' in param
| main.js | 185 | @S.Panfilov not sure - throw error here or just warn
| unit/main.spec.js | 283 | @S.Panfilov fix this test

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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