前端日志研究
MIT License
js
, ``, . , send
, :
var page = Log.create();
page.send('id', 1);
debug.js
,urlencode
debug.js
, . , , debug.js
.
| |
--- | --- | ---
| |
| |
| |
| |
urlencode
| |
/**
*
*
* @param {string} url gif
* @param {Object} options
*
* @return {Object}
*/
Log.create(url, options);
/**
*
*
* @param {Object|string} key key, . , string
* @param {string|undefined} value
*
* @return {Object} this
*/
#send(key, value);
// a
var clickLog = Log.create('/.gif', {
page: 'a',
type: 'click'
});
// apv
var pvLog = Log.create('/.gif', {
page: 'a',
type: 'pv'
});
//
clickLog.send({
id: 1,
width: 120
});
clickLog.send('xxxx', 1);
// pv
pvLog.send({
id: 1
});
pvLog.send('xxxx', 1);
debug.js
, ,
, , : selenium
json
, string
, send
, json
send
, , ,
mark
:cli
,alias
,const App = Log(options);
//
App.use('index.html');
// ,
App.mark('DOM_READY');
// ,
App.mark('ON_LOAD');
// +
let scrollTimer = null;
$(window).on('scroll.log', () => {
clearTimeout(scrollTimer);
scrollTimer = setTimeout(() => {
App.mark('READ_HEIGHT', window.scrollY);
App.mark('MAX_HEIGHT', window.scrollY, Log.markType.MAX);
}, 300);
});
// id
page.on('', () => {
App.mark('ARTICLE_ID', page.article_id, Log.markType.TIME);
});
//
page.on('', () => {
App.mark('ARTICLE_PAGE', page.current_page);
});