var time = true;
var tt = 0;
function timer() {
    //console.log("haha");
    if (tt < 5) {
        
        postMessage(tt + "分鐘前");
        tt++;
    } else {
        tt = 0
        postMessage("ok");
    };

    console.log(tt);
    
}

if (time) {
    var myVar = setInterval(function () { timer() }, 60000);
    time = false;
}