Sha256: e42f413f93b857822d19f572601ed72cf6558bf4e8049dfafa2636d2db08bf02
Contents?: true
Size: 803 Bytes
Versions: 106
Compression:
Stored size: 803 Bytes
Contents
/* ping.js - v0.2.2 http://github.com/alfg/ping.js */ var Ping=function(a){this.opt=a||{},this.favicon=this.opt.favicon||"/favicon.ico",this.timeout=this.opt.timeout||0,this.logError=this.opt.logError||!1};Ping.prototype.ping=function(a,b){function c(a){f.wasSuccess=!0,e.call(f,a)}function d(a){f.wasSuccess=!1,e.call(f,a)}function e(){g&&clearTimeout(g);var a=new Date-h;if("function"==typeof b)return this.wasSuccess?b(null,a):(f.logError&&console.error("error loading resource"),b("error",a))}var f=this;f.wasSuccess=!1,f.img=new Image,f.img.onload=c,f.img.onerror=d;var g,h=new Date;f.timeout&&(g=setTimeout(function(){e.call(f,void 0)},f.timeout)),f.img.src=a+f.favicon+"?"+ +new Date},"undefined"!=typeof exports?"undefined"!=typeof module&&module.exports&&(module.exports=Ping):window.Ping=Ping;
Version data entries
106 entries across 106 versions & 1 rubygems