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

@sensorskit/vue-on-modify

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sensorskit/vue-on-modify - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

src/util.js

2

lib/vue-on-modify.js

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

!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.VueOnModify=n():e.VueOnModify=n()}(window,function(){return function(e){var n={};function r(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=n,r.d=function(e,n,t){r.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:t})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},r.p="/lib/",r(r.s=0)}([function(e,n,r){"use strict";r.r(n);var t=function(e,n){return e!==n};var o={},u=[],i=function(){for(var e,n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];(e=console).error.apply(e,["[vue-on-modify]"].concat(function(e){if(Array.isArray(e)){for(var n=0,r=Array(e.length);n<e.length;n++)r[n]=e[n];return r}return Array.from(e)}(r)))},f=function(e,n,r){return e.addEventListener(n,r,!1),{el:e,destroy:function(){return e.removeEventListener(n,r,!1)}}},c=function(e,n,r){var o=n.value,c=e.value,a=null;if("function"==typeof o){l(e);u.push(f(e,"focus",function(){c=e.value}),f(e,"blur",function(){a=e.value,t(c,a)&&o(c,a)}))}else i("指令需要传入一个函数")},l=function(e){if(u.length)for(var n=u.length-1;n>=0;){var r=u[n];r.el===e&&(r.destroy(),u.splice(n,1)),n-=1}},a=function(e,n){n.value!==n.oldValue&&c(e,n)};o.install=function(e,n){var r=n&&n.directive?n.directive:"on-modify";e.directive(r,{bind:c,update:a,unbind:l})};n.default=o}])});
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.VueOnModify=n():e.VueOnModify=n()}(window,function(){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="/lib/",t(t.s=0)}([function(e,n,t){"use strict";t.r(n);var r=function(e,n){return e!==n},o=function(e){return u(e)?e:"DIV"===e.tagName&&e.querySelector("input")?e.querySelector("input"):null},u=function(e){return"INPUT"===e.tagName};var i={},f=[],c=function(){for(var e,n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];(e=console).error.apply(e,["[vue-on-modify]"].concat(function(e){if(Array.isArray(e)){for(var n=0,t=Array(e.length);n<e.length;n++)t[n]=e[n];return t}return Array.from(e)}(t)))},l=function(e,n,t){return e.addEventListener(n,t,!1),{el:e,destroy:function(){return e.removeEventListener(n,t,!1)}}},a=function(e,n,t){if(!(e=o(e)))return c("绑定的元素内未找到 input 标签!");var u=n.value,i=e.value,a=null;if("function"==typeof u){d(e);f.push(l(e,"focus",function(){i=e.value}),l(e,"blur",function(){a=e.value,r(i,a)&&u(i,a)}))}else c("指令需要传入一个函数")},d=function(e){if(e=o(e),f.length)for(var n=f.length-1;n>=0;){var t=f[n];t.el===e&&(t.destroy(),f.splice(n,1)),n-=1}},p=function(e,n){n.value!==n.oldValue&&a(e,n)};i.install=function(e,n){var t=n&&n.directive?n.directive:"on-modify";e.directive(t,{bind:a,update:p,unbind:d})};n.default=i}])});
{
"name": "@sensorskit/vue-on-modify",
"description": "vue custom directive of modify binding",
"version": "0.0.1",
"version": "0.0.2",
"author": "newraina <newraina@users.noreply.github.com>",

@@ -6,0 +6,0 @@ "main": "lib/vue-on-modify.js",

import isModified from './isModified'
import { getInputFromEl } from './util'

@@ -20,2 +21,8 @@ const OnModifyPlugin = {}

const bind = (el, binding, vnode) => {
el = getInputFromEl(el)
if (!el) {
return log.e('绑定的元素内未找到 input 标签!')
}
const onModify = binding.value

@@ -43,9 +50,8 @@ let strOld = el.value

registeredHandlers.push(
on(el, 'focus', onFocus),
on(el, 'blur', onBlur)
)
registeredHandlers.push(on(el, 'focus', onFocus), on(el, 'blur', onBlur))
}
const unbind = el => {
el = getInputFromEl(el)
if (!registeredHandlers.length) {

@@ -74,3 +80,3 @@ return

OnModifyPlugin.install = function (Vue, options) {
OnModifyPlugin.install = function(Vue, options) {
const directiveName =

@@ -77,0 +83,0 @@ options && options.directive ? options.directive : 'on-modify'

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