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

@ued2345/octopus-util

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ued2345/octopus-util - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

2

dist/octopus-util.min.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OcUtil=t():e.OcUtil=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";t.__esModule=!0,t.default=function(){var e=navigator.userAgent;return{trident:e.indexOf("Trident")>-1,presto:e.indexOf("Presto")>-1,webKit:e.indexOf("AppleWebKit")>-1,gecko:e.indexOf("Gecko")>-1&&-1===e.indexOf("KHTML"),mobile:!!e.match(/AppleWebKit.*Mobile.*/)||e.indexOf("Mobile")>-1,ios:!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),android:e.indexOf("Android")>-1||e.indexOf("Linux")>-1,iPhone:e.indexOf("iPhone")>-1,iPad:e.indexOf("iPad")>-1,webApp:-1===e.indexOf("Safari"),weixin:e.indexOf("MicroMessenger")>-1,qq:null!==e.match(/\sQQ/i)}}},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t,n){var r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3);var o="expires="+r.toUTCString();document.cookie=e+"="+t+";path=/;;"+o}},function(e,t,n){"use strict";var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var i=o(n(0)),u=o(n(3)),c=o(n(4)),a=o(n(6)),l=o(n(1)),f=o(n(7)),s=o(n(8));e.exports.default=e.exports=r({getBrowser:i.default,getInApp:u.default,JsBridge:c.default,getCookie:a.default,setCookie:l.default,delCookie:f.default},s.default)},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e){return!!(navigator.userAgent.indexOf(e)>-1)}},function(e,t,n){"use strict";var r,o=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var u=new(function(e){function t(){return e.call(this)||this}return o(t,e),t.prototype.callHandler=function(t,n){e.prototype.init.call(this,(function(e){e.callHandler("jsCallJavaAllInOne",t,n)}))},t.prototype.registerHandler=function(t,n){e.prototype.init.call(this,(function(e){e.registerHandler(t,n)}))},t}(i(n(5)).default));u.first(),t.default={callHandler:u.callHandler,registerHandler:u.registerHandler}},function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var o=r(n(0)).default(),i=function(){function e(){this.isIOS=o.ios}return e.prototype.init=function(e){if(this.isIOS){if(window.WebViewJavascriptBridge)return e(window.WebViewJavascriptBridge);if(window.WVJBCallbacks)return window.WVJBCallbacks.push(e);window.WVJBCallbacks=[e];var t=document.createElement("iframe");t.style.display="none",t.src="wvjbscheme://__BRIDGE_LOADED__",document.documentElement.appendChild(t),setTimeout((function(){document.documentElement.removeChild(t)}),0)}else window.WebViewJavascriptBridge?e(window.WebViewJavascriptBridge):document.addEventListener("WebViewJavascriptBridgeReady",(function(){e(window.WebViewJavascriptBridge)}),!1)},e.prototype.first=function(){this.isIOS||this.init((function(e){e.init((function(e,t){t()}))}))},e}();t.default=i},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e){for(var t=document.cookie.replace(/\s/g,"").split(";"),n=0;n<t.length;n++){var r=t[n].split("=");if(r[0]==e)return decodeURIComponent(r[1])}return""}},function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var o=r(n(1));t.default=function(e){o.default(e,"",-1)}},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var i=o(n(9));t.default={install:function(e,t){Object.keys(i.default).forEach((function(n){"object"===r(i.default[n])?e.directive(n,i.default[n]):"function"==typeof i.default[n]&&e.directive(n,new i.default[n](t[n]))}))}}},function(e,t,n){"use strict";var r=function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var o=r(n(10));t.default={bang:o.default}},function(e,t,n){"use strict";var r,o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};t.__esModule=!0,function(e){e.Exposure="exposure",e.Click="click",e.Mounted="mounted"}(r||(r={}));var i=function(e){var t=this;this.inserted=function(e,n,o,i){var u,c,a;switch(n.arg){case r.Exposure:new Promise((function(n,r){"IMG"===e.tagName?(e.onload=function(){var r=e.getAttribute("data-src"),o=e.getAttribute("src");((r?r===o:o)||t.config.imgErrExposure)&&n(!0)},e.onerror=function(e){t.config.imgErrExposure?n(!0):r(e)}):n(!0)})).then((function(r){r&&IntersectionObserver&&(e.observer=new IntersectionObserver((function(r){r[0].intersectionRatio>=.95&&(t.callback(e,n,o,i),t.config.exposureMulti||e.observer.unobserve(e))}),{root:null,threshold:[.95]}),e.observer.observe(e))})).catch((function(e){console.error(e)}));break;case r.Click:var l=(u=t.callback,c=(c=t.config.clickThrottleInterval)||2e3,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this,r=+new Date;a&&r-a<c||(a=r,u.apply(n,e))});e.bangClickCb=function(){l(e,n,o,i)},e.addEventListener("click",e.bangClickCb);break;case r.Mounted:t.callback(e,n,o,i);break;default:t.callback(e,n,o,i)}},this.unbind=function(e,n){switch(n.arg){case r.Exposure:t.config.exposureMulti&&e.observer&&e.observer.unobserve(e);case r.Click:e.removeEventListener("click",e.bangClickCb)}},this.config=o(o({},this.DefaultConfig),e),this.callback=this.config.cb};t.default=i}])}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.OcUtil=t():e.OcUtil=t()}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";t.__esModule=!0,t.default=function(){var e=navigator.userAgent;return{trident:e.indexOf("Trident")>-1,presto:e.indexOf("Presto")>-1,webKit:e.indexOf("AppleWebKit")>-1,gecko:e.indexOf("Gecko")>-1&&-1===e.indexOf("KHTML"),mobile:!!e.match(/AppleWebKit.*Mobile.*/)||e.indexOf("Mobile")>-1,ios:!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),android:e.indexOf("Android")>-1||e.indexOf("Linux")>-1,iPhone:e.indexOf("iPhone")>-1,iPad:e.indexOf("iPad")>-1,webApp:-1===e.indexOf("Safari"),weixin:e.indexOf("MicroMessenger")>-1,qq:null!==e.match(/\sQQ/i)}}},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t,n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3);var r="expires="+o.toUTCString();document.cookie=e+"="+t+";path=/;;"+r}},function(e,t,n){"use strict";var o=function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var r=o(n(0)),i=o(n(3)),u=o(n(4)),c=o(n(6)),a=o(n(1)),l=o(n(7)),f=o(n(8));e.exports.default=e.exports={getBrowser:r.default,getInApp:i.default,JsBridge:u.default,getCookie:c.default,setCookie:a.default,delCookie:l.default,VuePlugin:f.default}},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e){return!!(navigator.userAgent.indexOf(e)>-1)}},function(e,t,n){"use strict";var o,r=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var u=new(function(e){function t(){return e.call(this)||this}return r(t,e),t.prototype.callHandler=function(t,n){e.prototype.init.call(this,(function(e){e.callHandler("jsCallJavaAllInOne",t,n)}))},t.prototype.registerHandler=function(t,n){e.prototype.init.call(this,(function(e){e.registerHandler(t,n)}))},t}(i(n(5)).default));u.first(),t.default={callHandler:u.callHandler,registerHandler:u.registerHandler}},function(e,t,n){"use strict";var o=function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var r=o(n(0)).default(),i=function(){function e(){this.isIOS=r.ios}return e.prototype.init=function(e){if(this.isIOS){if(window.WebViewJavascriptBridge)return e(window.WebViewJavascriptBridge);if(window.WVJBCallbacks)return window.WVJBCallbacks.push(e);window.WVJBCallbacks=[e];var t=document.createElement("iframe");t.style.display="none",t.src="wvjbscheme://__BRIDGE_LOADED__",document.documentElement.appendChild(t),setTimeout((function(){document.documentElement.removeChild(t)}),0)}else window.WebViewJavascriptBridge?e(window.WebViewJavascriptBridge):document.addEventListener("WebViewJavascriptBridgeReady",(function(){e(window.WebViewJavascriptBridge)}),!1)},e.prototype.first=function(){this.isIOS||this.init((function(e){e.init((function(e,t){t()}))}))},e}();t.default=i},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e){for(var t=document.cookie.replace(/\s/g,"").split(";"),n=0;n<t.length;n++){var o=t[n].split("=");if(o[0]==e)return decodeURIComponent(o[1])}return""}},function(e,t,n){"use strict";var o=function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var r=o(n(1));t.default=function(e){r.default(e,"",-1)}},function(e,t,n){"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var i=r(n(9));t.default={install:function(e,t){Object.keys(i.default).forEach((function(n){"object"===o(i.default[n])?e.directive(n,i.default[n]):"function"==typeof i.default[n]&&e.directive(n,new i.default[n](t[n]))}))}}},function(e,t,n){"use strict";var o=function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var r=o(n(10));t.default={bang:r.default}},function(e,t,n){"use strict";var o,r=function(){return(r=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};t.__esModule=!0,function(e){e.Exposure="exposure",e.Click="click",e.Mounted="mounted"}(o||(o={}));var i=function(e){var t=this;this.inserted=function(e,n,r,i){var u,c,a;switch(n.arg){case o.Exposure:new Promise((function(n,o){"IMG"===e.tagName?(e.onload=function(){var o=e.getAttribute("data-src"),r=e.getAttribute("src");((o?o===r:r)||t.config.imgErrExposure)&&n(!0)},e.onerror=function(e){t.config.imgErrExposure?n(!0):o(e)}):n(!0)})).then((function(o){o&&IntersectionObserver&&(e.observer=new IntersectionObserver((function(o){o[0].intersectionRatio>=.95&&(t.callback(e,n,r,i),t.config.exposureMulti||e.observer.unobserve(e))}),{root:null,threshold:[.95]}),e.observer.observe(e))})).catch((function(e){console.error(e)}));break;case o.Click:var l=(u=t.callback,c=(c=t.config.clickThrottleInterval)||2e3,function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this,o=+new Date;a&&o-a>0&&o-a<c||(a=o,u.apply(n,e))});e.bangClickCb=function(){l(e,n,r,i)},e.addEventListener("click",e.bangClickCb);break;case o.Mounted:t.callback(e,n,r,i);break;default:t.callback(e,n,r,i)}},this.unbind=function(e,n){switch(n.arg){case o.Exposure:t.config.exposureMulti&&e.observer&&e.observer.unobserve(e);case o.Click:e.removeEventListener("click",e.bangClickCb)}},this.config=r(r({},this.DefaultConfig),e),this.callback=this.config.cb};t.default=i}])}));
{
"name": "@ued2345/octopus-util",
"version": "1.1.4",
"version": "1.1.5",
"description": "ued2345 utils",

@@ -5,0 +5,0 @@ "main": "dist/octopus-util.min.js",

@@ -103,3 +103,6 @@ ### 技术选型

- 适用场景
> 优化大部分曝光、挂载、点击的埋点的上报的书写方式,使用vue指令的方式
> 可以改善以下三种情况下埋点代码的书写方式:
> 1. 曝光: exposure(当该元素95%以上展示在可视区的时候触发)。
> 2. 挂载: mounted(当该元素的dom生成的时候触发)。
> 3. 点击: click(当该元素被点击的时候触发)。
- 使用示例

@@ -110,6 +113,6 @@ ```javascript

import OcUtil from '@ued2345/octopus-util'
import {VuePlugin} from '@ued2345/octopus-util'
// 模拟上报函数(参数同vue自定义指令)
const bang = (el, binding) => {console.log(`触发上报,类型:${binding.arg},值: ${binding.value}`)}
Vue.use(OcUtil, {
Vue.use(VuePlugin, {
bang: {

@@ -123,2 +126,4 @@ // 自定义配置

<div v-bang:exposure="`我曝光啦`"></div> //曝光后输出: "触发上报,类型:exposure,值: 我曝光啦"
<div v-bang:click="`我被点啦`"></div> //点击后输出: "触发上报,类型:click,值: 我被点啦"
<div v-bang:mounted="`我出生了啦`"></div> //dom生成后输出: "触发上报,类型:mounted,值: 我出生了啦"

@@ -125,0 +130,0 @@ ```

@@ -19,3 +19,3 @@ /**

delCookie,
...VuePlugin // vue工具(内含insert方法)
VuePlugin // vue工具(内含insert方法)
};

@@ -144,3 +144,3 @@ type Config = {

const now = +new Date();
if (last && now - last < interval) {
if (last && now - last > 0 && now - last < interval) {
// empty

@@ -147,0 +147,0 @@ } else {

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