fex-team / alogs Goto Github PK
View Code? Open in Web Editor NEW前端统计框架
前端统计框架
先说声不好意思,在issue里提这样的问题
源码:
var name = 'img_' + (+new Date());
entry[name] = image;
image.onload = image.onerror = function () {
entry[name] =
image =
image.onload =
image.onerror = null;
delete entry[name];
};
为什么要将 image 挂在entry对象上?然后是这个函数执行完后image不就销毁了吗?为什么还要通过监听onload和onerror来销毁?
文档中有描述:
moduleTracker.start(fields) 同步方法(Sync)
alog('module.start', fields) 异步方法(Async)
这里面的start 是Tracker的方法吗?alogs.js的代码里没有发现?
rt
entry.p = entry.q = { // 接管之前的定义
push: function (args) {
entry.apply(entry, args);
}
};
// 开始处理缓存命令
for (var i = 0; i < items.length; i++) {
entry.apply(entry, items[i]);
}
上面的代码中entry.apply(entry, args);不是等同于entry(args);吗?为什么要通过apply方法调用呢
1.函数嵌套函数是一种不推荐的方式吧?
http://js8.in/2011/10/19/javascript%E5%B5%8C%E5%A5%97%E5%87%BD%E6%95%B0%E7%9A%84%E6%95%88%E7%8E%87%E9%97%AE%E9%A2%98/
2.为什么不绑在entry的原型对象上?
例如entry.prototype.on = on
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.