UNPKG

@yuanjili/js-es-c

Version:

js工具包

1 lines 1.23 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.trick=trick,exports.vconsoleCount=vconsoleCount,exports.setupVConsoleTrigger=setupVConsoleTrigger;var vconsoleCountValue=0,vconsoleTimeout=null,vconsoleInstance=null;function trick(a){var b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:4,c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:2e3,d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:{};vconsoleCountValue++,vconsoleTimeout||(vconsoleTimeout=setTimeout(function(){vconsoleCountValue=0,vconsoleTimeout=null},c)),vconsoleCount(vconsoleCountValue,a,b,d)}function vconsoleCount(a,b,c){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:{};if(a>c&&(vconsoleTimeout=null,!vconsoleInstance&&b))try{vconsoleInstance=new b(d)}catch(a){console.error("\u521D\u59CB\u5316 VConsole \u5931\u8D25:",a)}}function setupVConsoleTrigger(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:4,d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:2e3,e=4<arguments.length&&arguments[4]!==void 0?arguments[4]:{},f=document.getElementById(a);f?f.addEventListener("click",function(){trick(b,c,d,e)}):console.error("\u672A\u627E\u5230 id \u4E3A "+a+" \u7684\u5143\u7D20")}