提交 d29aafef 编写于 作者: M mehaotian

chore(uni-stat): update package.json

上级 19c93125
'use strict'; 'use strict';
var Vue = require('vue');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);
/** /**
* 获取系统信息 * 获取系统信息
*/ */
...@@ -1078,18 +1072,15 @@ class Report { ...@@ -1078,18 +1072,15 @@ class Report {
} }
} }
let vue = (Vue__default["default"].default || Vue__default["default"]);
class Stat extends Report { class Stat extends Report {
static getInstance() { static getInstance() {
if (!vue.instance) { if (!uni.__stat_instance) {
vue.instance = new Stat(); uni.__stat_instance = new Stat();
} }
return vue.instance return uni.__stat_instance
} }
constructor() { constructor() {
super(); super();
this.instance = null;
} }
/** /**
...@@ -1235,45 +1226,37 @@ const lifecycle = { ...@@ -1235,45 +1226,37 @@ const lifecycle = {
}; };
function main() { function main() {
// console.log('--- 统计开启') // console.log('--- 统计开启')
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
uni.report = function(type, options) {}; uni.report = function(type, options) {};
} else { } else {
// #ifdef VUE3 // #ifdef VUE3
uni.onCreateVueApp((app) => { uni.onCreateVueApp((app) => {
app.mixin(lifecycle); app.mixin(lifecycle);
uni.report = function(type, options) { uni.report = function(type, options) {
stat.sendEvent(type, options); stat.sendEvent(type, options);
}; };
}); });
uni.onAppLaunch((options) => {
stat.launch(options); if (get_platform_name() !== 'h5' && get_platform_name() !== 'n') {
// 小程序平台此时也无法获取getApp,统一在options中传递一个app mixin对象 uni.onAppHide(() => {
options.app.mixin(lifecycle); stat.appHide(get_page_vm());
uni.report = function (type, options) { });
stat.sendEvent(type, options); uni.onAppShow(() => {
}; stat.appShow(get_page_vm());
}); });
}
if (get_platform_name() !== 'h5' && get_platform_name() !== 'n') { // #endif
uni.onAppHide(() => {
stat.appHide(get_page_vm()); // #ifndef VUE3
}); const Vue = require('vue');
uni.onAppShow(() => { (Vue.default || Vue).mixin(lifecycle);
stat.appShow(get_page_vm()); uni.report = function(type, options) {
}); stat.sendEvent(type, options);
} };
// #endif // #endif
}
// #ifndef VUE3
const Vue = require('vue');
(Vue.default || Vue).mixin(lifecycle);
uni.report = function(type, options) {
stat.sendEvent(type, options);
};
// #endif
}
} }
main(); main();
import Vue from 'vue';
/** /**
* 获取系统信息 * 获取系统信息
*/ */
...@@ -1072,18 +1070,15 @@ class Report { ...@@ -1072,18 +1070,15 @@ class Report {
} }
} }
let vue = (Vue.default || Vue);
class Stat extends Report { class Stat extends Report {
static getInstance() { static getInstance() {
if (!vue.instance) { if (!uni.__stat_instance) {
vue.instance = new Stat(); uni.__stat_instance = new Stat();
} }
return vue.instance return uni.__stat_instance
} }
constructor() { constructor() {
super(); super();
this.instance = null;
} }
/** /**
...@@ -1229,45 +1224,37 @@ const lifecycle = { ...@@ -1229,45 +1224,37 @@ const lifecycle = {
}; };
function main() { function main() {
// console.log('--- 统计开启') // console.log('--- 统计开启')
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
uni.report = function(type, options) {}; uni.report = function(type, options) {};
} else { } else {
// #ifdef VUE3 // #ifdef VUE3
uni.onCreateVueApp((app) => { uni.onCreateVueApp((app) => {
app.mixin(lifecycle); app.mixin(lifecycle);
uni.report = function(type, options) { uni.report = function(type, options) {
stat.sendEvent(type, options); stat.sendEvent(type, options);
}; };
}); });
uni.onAppLaunch((options) => {
stat.launch(options); if (get_platform_name() !== 'h5' && get_platform_name() !== 'n') {
// 小程序平台此时也无法获取getApp,统一在options中传递一个app mixin对象 uni.onAppHide(() => {
options.app.mixin(lifecycle); stat.appHide(get_page_vm());
uni.report = function (type, options) { });
stat.sendEvent(type, options); uni.onAppShow(() => {
}; stat.appShow(get_page_vm());
}); });
}
if (get_platform_name() !== 'h5' && get_platform_name() !== 'n') { // #endif
uni.onAppHide(() => {
stat.appHide(get_page_vm()); // #ifndef VUE3
}); const Vue = require('vue');
uni.onAppShow(() => { (Vue.default || Vue).mixin(lifecycle);
stat.appShow(get_page_vm()); uni.report = function(type, options) {
}); stat.sendEvent(type, options);
} };
// #endif // #endif
}
// #ifndef VUE3
const Vue = require('vue');
(Vue.default || Vue).mixin(lifecycle);
uni.report = function(type, options) {
stat.sendEvent(type, options);
};
// #endif
}
} }
main(); main();
'use strict'; 'use strict';
var Vue = require('vue');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);
/** /**
* 获取系统信息 * 获取系统信息
*/ */
...@@ -1093,18 +1087,15 @@ class Report { ...@@ -1093,18 +1087,15 @@ class Report {
} }
} }
let vue = (Vue__default["default"].default || Vue__default["default"]);
class Stat extends Report { class Stat extends Report {
static getInstance() { static getInstance() {
if (!vue.instance) { if (!uni.__stat_instance) {
vue.instance = new Stat(); uni.__stat_instance = new Stat();
} }
return vue.instance return uni.__stat_instance
} }
constructor() { constructor() {
super(); super();
this.instance = null;
} }
/** /**
...@@ -1250,45 +1241,37 @@ const lifecycle = { ...@@ -1250,45 +1241,37 @@ const lifecycle = {
}; };
function main() { function main() {
// console.log('--- 统计开启') // console.log('--- 统计开启')
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
uni.report = function(type, options) {}; uni.report = function(type, options) {};
} else { } else {
// #ifdef VUE3 // #ifdef VUE3
uni.onCreateVueApp((app) => { uni.onCreateVueApp((app) => {
app.mixin(lifecycle); app.mixin(lifecycle);
uni.report = function(type, options) { uni.report = function(type, options) {
stat.sendEvent(type, options); stat.sendEvent(type, options);
}; };
}); });
uni.onAppLaunch((options) => {
stat.launch(options); if (get_platform_name() !== 'h5' && get_platform_name() !== 'n') {
// 小程序平台此时也无法获取getApp,统一在options中传递一个app mixin对象 uni.onAppHide(() => {
options.app.mixin(lifecycle); stat.appHide(get_page_vm());
uni.report = function (type, options) { });
stat.sendEvent(type, options); uni.onAppShow(() => {
}; stat.appShow(get_page_vm());
}); });
}
if (get_platform_name() !== 'h5' && get_platform_name() !== 'n') { // #endif
uni.onAppHide(() => {
stat.appHide(get_page_vm()); // #ifndef VUE3
}); const Vue = require('vue');
uni.onAppShow(() => { (Vue.default || Vue).mixin(lifecycle);
stat.appShow(get_page_vm()); uni.report = function(type, options) {
}); stat.sendEvent(type, options);
} };
// #endif // #endif
}
// #ifndef VUE3
const Vue = require('vue');
(Vue.default || Vue).mixin(lifecycle);
uni.report = function(type, options) {
stat.sendEvent(type, options);
};
// #endif
}
} }
main(); main();
import Vue from 'vue';
/** /**
* 获取系统信息 * 获取系统信息
*/ */
...@@ -1087,18 +1085,15 @@ class Report { ...@@ -1087,18 +1085,15 @@ class Report {
} }
} }
let vue = (Vue.default || Vue);
class Stat extends Report { class Stat extends Report {
static getInstance() { static getInstance() {
if (!vue.instance) { if (!uni.__stat_instance) {
vue.instance = new Stat(); uni.__stat_instance = new Stat();
} }
return vue.instance return uni.__stat_instance
} }
constructor() { constructor() {
super(); super();
this.instance = null;
} }
/** /**
...@@ -1244,45 +1239,37 @@ const lifecycle = { ...@@ -1244,45 +1239,37 @@ const lifecycle = {
}; };
function main() { function main() {
// console.log('--- 统计开启') // console.log('--- 统计开启')
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
uni.report = function(type, options) {}; uni.report = function(type, options) {};
} else { } else {
// #ifdef VUE3 // #ifdef VUE3
uni.onCreateVueApp((app) => { uni.onCreateVueApp((app) => {
app.mixin(lifecycle); app.mixin(lifecycle);
uni.report = function(type, options) { uni.report = function(type, options) {
stat.sendEvent(type, options); stat.sendEvent(type, options);
}; };
}); });
uni.onAppLaunch((options) => {
stat.launch(options); if (get_platform_name() !== 'h5' && get_platform_name() !== 'n') {
// 小程序平台此时也无法获取getApp,统一在options中传递一个app mixin对象 uni.onAppHide(() => {
options.app.mixin(lifecycle); stat.appHide(get_page_vm());
uni.report = function (type, options) { });
stat.sendEvent(type, options); uni.onAppShow(() => {
}; stat.appShow(get_page_vm());
}); });
}
if (get_platform_name() !== 'h5' && get_platform_name() !== 'n') { // #endif
uni.onAppHide(() => {
stat.appHide(get_page_vm()); // #ifndef VUE3
}); const Vue = require('vue');
uni.onAppShow(() => { (Vue.default || Vue).mixin(lifecycle);
stat.appShow(get_page_vm()); uni.report = function(type, options) {
}); stat.sendEvent(type, options);
} };
// #endif // #endif
}
// #ifndef VUE3
const Vue = require('vue');
(Vue.default || Vue).mixin(lifecycle);
uni.report = function(type, options) {
stat.sendEvent(type, options);
};
// #endif
}
} }
main(); main();
{ {
"name": "@dcloudio/uni-stat", "name": "@dcloudio/uni-stat",
"version": "3.0.0-alpha-3040020220301001", "version": "3.0.0-alpha-3040320220325006",
"description": "@dcloudio/uni-stat", "description": "@dcloudio/uni-stat",
"main": "dist/uni-stat.es.js", "main": "dist/uni-stat.es.js",
"module": "dist/uni-stat.es.js", "module": "dist/uni-stat.es.js",
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
}, },
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da", "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
"dependencies": { "dependencies": {
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3040020220301001", "@dcloudio/uni-cli-shared": "3.0.0-alpha-3040320220325006",
"debug": "^4.3.3" "debug": "^4.3.3"
}, },
"devDependencies": { "devDependencies": {
......
import Report from './report.js' import Report from './report.js'
import Vue from 'vue'
let vue = (Vue.default || Vue)
import { import {
set_page_residence_time set_page_residence_time
} from '../utils/pageTime.js' } from '../utils/pageTime.js'
...@@ -11,14 +10,13 @@ import { ...@@ -11,14 +10,13 @@ import {
class Stat extends Report { class Stat extends Report {
static getInstance() { static getInstance() {
if (!vue.instance) { if (!uni.__stat_instance) {
vue.instance = new Stat() uni.__stat_instance = new Stat()
} }
return vue.instance return uni.__stat_instance
} }
constructor() { constructor() {
super() super()
this.instance = null
} }
/** /**
......
import { import {
get_platform_name, get_platform_name,
get_page_vm get_page_vm
} from './utils/pageInfo.js' } from './utils/pageInfo.js'
import Stat from './core/stat.js' import Stat from './core/stat.js'
const stat = Stat.getInstance() const stat = Stat.getInstance()
...@@ -45,45 +45,37 @@ const lifecycle = { ...@@ -45,45 +45,37 @@ const lifecycle = {
} }
function main() { function main() {
// console.log('--- 统计开启') // console.log('--- 统计开启')
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
uni.report = function(type, options) {} uni.report = function(type, options) {}
} else { } else {
// #ifdef VUE3 // #ifdef VUE3
uni.onCreateVueApp((app) => { uni.onCreateVueApp((app) => {
app.mixin(lifecycle) app.mixin(lifecycle)
uni.report = function(type, options) { uni.report = function(type, options) {
stat.sendEvent(type, options) stat.sendEvent(type, options)
} }
}) })
uni.onAppLaunch((options) => {
stat.launch(options) if (get_platform_name() !== 'h5' && get_platform_name() !== 'n') {
// 小程序平台此时也无法获取getApp,统一在options中传递一个app mixin对象 uni.onAppHide(() => {
options.app.mixin(lifecycle) stat.appHide(get_page_vm());
uni.report = function (type, options) { })
stat.sendEvent(type, options) uni.onAppShow(() => {
} stat.appShow(get_page_vm());
}) })
}
if (get_platform_name() !== 'h5' && get_platform_name() !== 'n') { // #endif
uni.onAppHide(() => {
stat.appHide(get_page_vm()); // #ifndef VUE3
}) const Vue = require('vue');
uni.onAppShow(() => { (Vue.default || Vue).mixin(lifecycle);
stat.appShow(get_page_vm()); uni.report = function(type, options) {
}) stat.sendEvent(type, options);
} };
// #endif // #endif
}
// #ifndef VUE3
const Vue = require('vue');
(Vue.default || Vue).mixin(lifecycle);
uni.report = function(type, options) {
stat.sendEvent(type, options);
};
// #endif
}
} }
main() main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册