Skip to content

Instantly share code, notes, and snippets.

@zenxds
Created January 20, 2015 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zenxds/330db5125a907ac5387a to your computer and use it in GitHub Desktop.
Save zenxds/330db5125a907ac5387a to your computer and use it in GitHub Desktop.
function log(url, callback) {
// 防止请求被垃圾回收
var image = new Image(),
id = "_tbtx_" + Math.random();
window[id] = image;
image.onload = image.onerror = function() {
window[id] = null;
if (callback) {
callback();
}
};
image.src = url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment