@qihoo/fx-mp
Advanced tools
Comparing version 0.0.0-development to 0.0.0
@@ -1,1 +0,1 @@ | ||
var e=function(){return(e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var t={},r=function(e){t=e},n=function(r){var n={ep:(new Date).getTime()},o=e(e(e({},t),r),n);console.log("send log params:",o),function(e,t,r){var n=qh&&qh.request;if(!n)return!1;n({method:"POST",url:e,data:t,header:{"content-type":"application/x-www-form-urlencoded"},timeout:3e3,success:function(e){return r&&r(null,e),!0},fail:function(e){return r&&r(e,null),!1}})}("https://s.union.360.cn/m.gif",o)},o=function(e){return e.reverse().reduce((function(e,t,r){return e+=+t*Math.pow(10,r)}),0)},i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function c(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s={next:function(e){},error:function(e){throw new Error(e)},complete:function(){}},u=function(){function e(t,r,n){var o=Array.from(arguments).filter((function(e){return e})).length;switch(o){case 0:this.observer=this.safeObserver(s);break;case 1:this.observer=t instanceof e?t:this.safeObserver(t);break;default:this.observer=this.safeObserver(t,r,n)}}return e.prototype.safeObserver=function(e,t,r){var n;return"function"==typeof e?n=e:(n=e.next||s.next,t=e.error||s.error,r=e.complete||s.complete),{next:n,error:t,complete:r}},e.prototype.next=function(e){this.isStopped||this.observer.next(e)},e.prototype.error=function(e){this.isStopped||(this.observer.error(e),this.unsubscribe())},e.prototype.complete=function(){this.isStopped||(this.observer.complete(),this.unsubscribe())},e.prototype.unsubscribe=function(){this.isStopped=!0},e}(),a=function(e){function t(t,r){var n=e.call(this,t)||this;return n.callback=r,n.next=n.next.bind(n),n.complete=n.complete.bind(n),n}return c(t,e),t.prototype.next=function(e){try{this.observer.next(this.callback(e))}catch(e){this.observer.error(e)}},t.prototype.complete=function(){this.observer.complete()},t}(u),p=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.callback=r,o.result=n,o.next=o.next.bind(o),o.complete=o.complete.bind(o),o}return c(t,e),t.prototype.complete=function(){this.observer.next(this.result),this.observer.complete()},t.prototype.next=function(e){try{this.result=this.callback(this.result,e)}catch(e){this.observer.error(e)}},t}(u),f=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.subscribe=function(e,t,r){var n=new u(e,t,r);if(this.operator)this.operator.call(n,this.source);else{if(!this._subscribe)throw new Error("Observable class need subscribe function for creating!");this._subscribe(n)}return n},e.prototype.create=function(t){return new e(t)},e.prototype.map=function(t){var r=new e;return r.source=this,r.operator={call:function(e,r){var n=new a(e,t);return r.subscribe(n)}},r},e.prototype.reduce=function(t,r){var n=new e;return n.source=this,n.operator={call:function(e,n){var o=new p(e,t,r);return n.subscribe(o)}},n},e.prototype.fromEvent=function(t,r){return new e((function(e){var n=document.getElementsByTagName(t),o=document.getElementById(t)?[document.getElementById(t)]:[],i=document.getElementsByClassName(t),c=n.length&&n||o.length&&o||i.length&&i||[];Array.from(c).forEach((function(t){t.addEventListener(r,(function(t){e.next(t)}),!0)}))}))},e.prototype.fromDelegateClick=function(t){return new e((function(e){document.body.addEventListener("click",(function(r){var n=r.target.id&&r.target.id.includes(t),o=r.target.tagName&&r.target.tagName.includes(t.toLocaleUpperCase());(n||o)&&e.next(r)}),!0)}))},e.prototype.fromMpRouteChange=function(){return new e((function(e){window.addEventListener("routeChange",(function(t){e.next(t)}))}))},e.prototype.fromArray=function(t){if(!Array.isArray(t))throw new Error("params need to be an array");return new e((function(e){t.forEach((function(t){return e.next(t)})),e.complete()}))},e}(),l={next:function(e){var t=(new Date).getTime(),r=e.to.path,o=e.from.path,i=function(e,r){n({et:55,ptype:r,url:e,ep:t})};"/"!=o&&i(o,2),i(r,1)}},h={next:function(e){var t,r;console.log(e.target.id,"from custom click");var o=(new Date).getTime(),i=g.filter((function(t){return t.id==e.target.id||t.id.toLocaleUpperCase()===e.target.tagName}))[0];if(i){var c={et:56,fxeid:null===(t=i)||void 0===t?void 0:t.id,ename:null===(r=i)||void 0===r?void 0:r.name,ep:o};n(c)}}},b={next:function(e){console.log(e,"from click tracker");n({et:157})}},v={next:function(e){console.log(e,"from callback tracker"),n(e)}},y=function(){return function(e){return(new f).create((function(){})).subscribe(e).observer}(v)},m=function(){return function(e){return(new f).fromEvent("body","click").subscribe(e).observer}(b)},d=function(){return function(e){return(new f).fromMpRouteChange().subscribe(e).observer}(l)},g=[],w=[],x=function(e){var t=e.id;w.includes(t)||(!function(e,t){(new f).fromDelegateClick(e).subscribe(t).observer}(t,h),w.push(t),g.push(e))},k=function(e){Array.isArray(e)?e.map((function(e){x(e)})):x(e)},O=function(){function t(){this.funcObserver=y(),this.pageChangeObserver=d()}return t.prototype.register=function(t){var r={et:53,type:2};this.funcObserver.next(e(e({},t),r))},t.prototype.form=function(t){var r={et:53,type:3};this.funcObserver.next(e(e({},t),r))},t.prototype.payment=function(t){var r={et:57,type:2};this.funcObserver.next(e(e({},t),r))},t.prototype.setClickTarget=function(e){k(e)},t.prototype.setPageClick=function(){this.clickObserver||(this.clickObserver=m())},t.prototype.set=function(e,t){switch(e){case"clickTarget":k(t);break;case"pageClick":this.clickObserver||(this.clickObserver=m())}},t.prototype.send=function(e){this.funcObserver.next(e)},t}(),E=window._qha;!function(){if(!window.qh)throw new Error("该功能只在小程序环境才生效~");if(E)throw new Error("实例已存在无须重复注册~");var e,t,n,i,c=qh.getSystemInfoSync().SDKVersion;if(e=c,t="1.9.3".split("."),n=e.split("."),i=o(t),!(o(n)>=i))throw new Error("The current SDK version is not supported. Please upgrade to version 1.9.3+");var s=function(){var e=(new Date).getTime(),t=qh.getAppBaseInfoSync();if("string"==typeof t)try{t=JSON.parse(qh.getAppBaseInfoSync())}catch(e){t={title:"",version:""}}return{mpn:t.title,mpv:t.version||"",si:qh.getAppIdSync(),mid:qh.getDMSync(),mxt:senative.callsync("getChannelQuerySync","mxt")||"",pt:"",flt:e,jstype:"npm"}}();r(s),window._qha=new O}(); | ||
var e=function(){return(e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};var t={},r=function(e){t=e},n=function(r){var n={ep:(new Date).getTime()};!function(e,t,r){var n=qh&&qh.request;if(!n)return!1;n({method:"POST",url:e,data:t,header:{"content-type":"application/x-www-form-urlencoded"},timeout:3e3,success:function(e){return r&&r(null,e),!0},fail:function(e){return r&&r(e,null),!1}})}("https://s.union.360.cn/m.gif",e(e(e({},t),r),n))},o=function(e){return e.reverse().reduce((function(e,t,r){return e+=+t*Math.pow(10,r)}),0)},i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function c(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s={next:function(e){},error:function(e){throw new Error(e)},complete:function(){}},u=function(){function e(t,r,n){var o=Array.from(arguments).filter((function(e){return e})).length;switch(o){case 0:this.observer=this.safeObserver(s);break;case 1:this.observer=t instanceof e?t:this.safeObserver(t);break;default:this.observer=this.safeObserver(t,r,n)}}return e.prototype.safeObserver=function(e,t,r){var n;return"function"==typeof e?n=e:(n=e.next||s.next,t=e.error||s.error,r=e.complete||s.complete),{next:n,error:t,complete:r}},e.prototype.next=function(e){this.isStopped||this.observer.next(e)},e.prototype.error=function(e){this.isStopped||(this.observer.error(e),this.unsubscribe())},e.prototype.complete=function(){this.isStopped||(this.observer.complete(),this.unsubscribe())},e.prototype.unsubscribe=function(){this.isStopped=!0},e}(),a=function(e){function t(t,r){var n=e.call(this,t)||this;return n.callback=r,n.next=n.next.bind(n),n.complete=n.complete.bind(n),n}return c(t,e),t.prototype.next=function(e){try{this.observer.next(this.callback(e))}catch(e){this.observer.error(e)}},t.prototype.complete=function(){this.observer.complete()},t}(u),p=function(e){function t(t,r,n){var o=e.call(this,t)||this;return o.callback=r,o.result=n,o.next=o.next.bind(o),o.complete=o.complete.bind(o),o}return c(t,e),t.prototype.complete=function(){this.observer.next(this.result),this.observer.complete()},t.prototype.next=function(e){try{this.result=this.callback(this.result,e)}catch(e){this.observer.error(e)}},t}(u),f=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.subscribe=function(e,t,r){var n=new u(e,t,r);if(this.operator)this.operator.call(n,this.source);else{if(!this._subscribe)throw new Error("Observable class need subscribe function for creating!");this._subscribe(n)}return n},e.prototype.create=function(t){return new e(t)},e.prototype.map=function(t){var r=new e;return r.source=this,r.operator={call:function(e,r){var n=new a(e,t);return r.subscribe(n)}},r},e.prototype.reduce=function(t,r){var n=new e;return n.source=this,n.operator={call:function(e,n){var o=new p(e,t,r);return n.subscribe(o)}},n},e.prototype.fromEvent=function(t,r){return new e((function(e){var n=document.getElementsByTagName(t),o=document.getElementById(t)?[document.getElementById(t)]:[],i=document.getElementsByClassName(t),c=n.length&&n||o.length&&o||i.length&&i||[];Array.from(c).forEach((function(t){t.addEventListener(r,(function(t){e.next(t)}),!0)}))}))},e.prototype.fromDelegateClick=function(t){return new e((function(e){document.body.addEventListener("click",(function(r){var n=r.target.id&&r.target.id.includes(t),o=r.target.tagName&&r.target.tagName.includes(t.toLocaleUpperCase());(n||o)&&e.next(r)}),!0)}))},e.prototype.fromMpRouteChange=function(){return new e((function(e){window.addEventListener("routeChange",(function(t){e.next(t)}))}))},e.prototype.fromArray=function(t){if(!Array.isArray(t))throw new Error("params need to be an array");return new e((function(e){t.forEach((function(t){return e.next(t)})),e.complete()}))},e}(),l={next:function(e){var t=(new Date).getTime(),r=e.to.path,o=e.from.path,i=function(e,r){n({et:55,ptype:r,url:e,ep:t})};"/"!=o&&i(o,2),i(r,1)}},h={next:function(e){var t,r,o=(new Date).getTime(),i=w.filter((function(t){return t.id==e.target.id||t.id.toLocaleUpperCase()===e.target.tagName}))[0];if(i){var c={et:56,fxeid:null===(t=i)||void 0===t?void 0:t.id,ename:null===(r=i)||void 0===r?void 0:r.name,ep:o};n(c)}}},b={next:function(e){n({et:157})}},v={next:function(e){n(e)}},y=function(){return function(e){return(new f).create((function(){})).subscribe(e).observer}(v)},m=function(){return function(e){return(new f).fromEvent("body","click").subscribe(e).observer}(b)},d=function(){return function(e){return(new f).fromMpRouteChange().subscribe(e).observer}(l)},w=[],g=[],x=function(e){var t=e.id;g.includes(t)||(!function(e,t){(new f).fromDelegateClick(e).subscribe(t).observer}(t,h),g.push(t),w.push(e))},O=function(e){Array.isArray(e)?e.map((function(e){x(e)})):x(e)},k=function(){function t(){this.funcObserver=y(),this.pageChangeObserver=d()}return t.prototype.register=function(t){var r={et:53,type:2};this.funcObserver.next(e(e({},t),r))},t.prototype.form=function(t){var r={et:53,type:3};this.funcObserver.next(e(e({},t),r))},t.prototype.payment=function(t){var r={et:57,type:2};this.funcObserver.next(e(e({},t),r))},t.prototype.setClickTarget=function(e){O(e)},t.prototype.setPageClick=function(){this.clickObserver||(this.clickObserver=m())},t.prototype.set=function(e,t){switch(e){case"clickTarget":O(t);break;case"pageClick":this.clickObserver||(this.clickObserver=m())}},t.prototype.send=function(e){this.funcObserver.next(e)},t}(),E=window._qha;!function(){if(!window.qh)throw new Error("该功能只在小程序环境才生效~");if(E)throw new Error("实例已存在无须重复注册~");var e,t,n,i,c=qh.getSystemInfoSync().SDKVersion;if(e=c,t="1.9.3".split("."),n=e.split("."),i=o(t),!(o(n)>=i))throw new Error("The current SDK version is not supported. Please upgrade to version 1.9.3+");var s=function(){var e=(new Date).getTime(),t=qh.getAppBaseInfoSync();if("string"==typeof t)try{t=JSON.parse(qh.getAppBaseInfoSync())}catch(e){t={title:"",version:""}}return{mpn:t.title,mpv:t.version||"",si:qh.getAppIdSync(),mid:qh.getDMSync(),mxt:senative.callsync("getChannelQuerySync","mxt")||"",pt:"",flt:e,jstype:"npm"}}();r(s),window._qha=new k}(); |
{ | ||
"name": "@qihoo/fx-mp", | ||
"version": "0.0.0-development", | ||
"version": "0.0.0", | ||
"description": "fenxi for 360 small program", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -18,4 +18,9 @@ ## 360分析-小程序 | ||
``` | ||
建议在项目中的 app.js 文件中引入,脚本会自动运行,自定义行为的触发,请按后面说明进行使用。 | ||
建议在项目中的 app.js 文件中引入 | ||
```javascript | ||
import mp from "@qihoo/fx-mp" | ||
``` | ||
脚本会自动运行,自定义行为的触发,请按后面说明进行使用。 | ||
#### 二、自定义事件 | ||
@@ -78,1 +83,2 @@ | ||
})` | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
83
9091
25