支持旧版浏览器

在 Date.now() 不可用的旧浏览器中,请改用 (new Date()).getTime() :

t = (new Date()).getTime();

或者,要提供在旧版浏览器中使用的 Date.now() 函数,请使用此 polyfill :

if (!Date.now) {
  Date.now = function now() {
    return new Date().getTime();
  };
}