Skip to content

Instantly share code, notes, and snippets.

@amuntasim
Last active May 2, 2017 14:20
Show Gist options
  • Select an option

  • Save amuntasim/d8ec7bcc1ac7447c9026c466cad7dc37 to your computer and use it in GitHub Desktop.

Select an option

Save amuntasim/d8ec7bcc1ac7447c9026c466cad7dc37 to your computer and use it in GitHub Desktop.

Revisions

  1. amuntasim revised this gist May 2, 2017. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,5 @@

    var triggered = false;
    function delayed(method) {
    (function loop() {
    var now = new Date();
    // here the method will be triggered at 20:28, you can change them as per your need
    @@ -11,4 +10,3 @@ function delayed(method) {
    console.log('Now: ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds());
    setTimeout(loop, 200);
    })();
    }
  2. amuntasim created this gist Apr 30, 2017.
    14 changes: 14 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@

    var triggered = false;
    function delayed(method) {
    (function loop() {
    var now = new Date();
    // here the method will be triggered at 20:28, you can change them as per your need
    if (!triggered && now.getHours() === 20 && now.getMinutes() === 28) {
    method();
    triggered = true;
    }
    console.log('Now: ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds());
    setTimeout(loop, 200);
    })();
    }