杂货&&心跳

https://github.com/jsfront/month/blob/master/2016/201605.md

 

https://github.com/abdmob/x2js

 

https://leohxj.gitbooks.io/front-end-database/content/html-and-css-basic/css-position.html (ali样式手册)

 

http://velocityjs.org/#duration (动画库)

 

 

----------------------心跳时间设置--------------------------------------
var lastTime = (new Date()).getTime();
var checkInterval = 2000;
setInterval(function() {
var currentTime = (new Date()).getTime();
if (currentTime > (lastTime + 2000*2)) { // ignore small delays
// Probably just woke up! 执行唤醒工作
}
lastTime = currentTime;
}, checkInterval);


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

var myWorker = new Worker("DetectWakeup.js");
myWorker.onmessage = function (ev) {
if (ev && ev.data === 'wakeup') {
// wakeup here
}
}

// DetectWakeup.js (put in a separate file)
var lastTime = (new Date()).getTime();
var checkInterval = 10000;

setInterval(function () {
var currentTime = (new Date()).getTime();

if (currentTime > (lastTime + checkInterval * 2)) { // ignore small delays
postMessage("wakeup");
}

lastTime = currentTime;
}, checkInterval);


----------------------------------------------------------

posted @ 2016-07-05 11:17  火腿骑士  阅读(135)  评论(0编辑  收藏  举报