MCPcopy
hub / github.com/gongjunhao/seckill / updateTime

Function updateTime

src/js/utils.js:197–219  ·  view source on GitHub ↗

* 更新popup page的北京时间,剩余时间和设定后台的时间

(standerTime)

Source from the content-addressed store, hash-verified

195 * 更新popup page的北京时间,剩余时间和设定后台的时间
196 */
197function updateTime(standerTime) {
198 var timer = setInterval(function () {
199 standerTime += 1000;
200 $("#standTime").text(formatDateTime(standerTime));
201 $("span[datafld='leftTime']").each(function () {
202 $(this).text(getLeftTime(parseInt($(this).attr("killTime"))-standerTime+1000));
203 });
204 }, 1000);
205 if(oldTimer != null) {
206 clearInterval(oldTimer);
207 }
208
209 //更新Background的时间 开始
210 var port = chrome.extension.connect({
211 name: "update standerTime"
212 });
213 port.postMessage(standerTime);
214 port.onMessage.addListener(function(msg) {
215 console.log("后台反馈:" + msg);
216 });
217 //更新Background的时间 结束
218 oldTimer = timer;
219}
220
221
222function getLeftTime(leftTime) {

Callers 2

utils.jsFile · 0.85
getServerTimeAndUpdateFunction · 0.85

Calls 3

$Function · 0.85
getLeftTimeFunction · 0.85
formatDateTimeFunction · 0.70

Tested by

no test coverage detected