-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
67 lines (58 loc) · 1.75 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* Created by zhangye on 16/11/7.
*/
;(function (name, definition) {
// 检测上下文环境是否为AMD或CMD
var hasDefine = typeof define === 'function';
// 检查上下文环境是否为Node
var hasExports = typeof module !== 'undefined' && module.exports;
if (hasDefine) {
define(definition);
} else if (hasExports) {
module.exports = definition();
} else {
// 将模块的执行结果挂在window变量中,在浏览器中this指向window对象
var context = this;
context[name] = definition();
}
})('YonReporter', function () {
var YonReporter = function (options) {
this.userid = options.userid;
};
/**
* 当前屏幕的分辨率
* @returns {string}
*/
YonReporter.prototype.resolution = function () {
var html = document.documentElement;
return Math.max(html.clientWidth, window.innerWidth || 0) + 'x' + Math.max(html.clientHeight, window.innerHeight || 0)
};
/**
* 自动记录用户名、IP、时间戳。
* 压缩参数(每个参数精简为 2-3 个字母)。
*
* @param where
* @param doing
* @param thing
*/
YonReporter.prototype.track = function (where, doing, thing) {
var info = {
location: location.href,
referrer: document.referrer
};
};
/**
* 发送 GET 请求。
*/
YonReporter.prototype.exec = function () {
};
/**
* 收集信息的类型
* @type {{PLATFORM: string, USER_BEHAVIOUR: string}}
*/
YonReporter.category = {
PLATFORM : 'platform', // 客户端平台信息
USER_BEHAVIOUR: 'user_behaviour' // 客户端用户行为信息
};
return YonReporter;
});