0

私は SetInterval 経由で Pebble.JS を使用して Pebble にストップウォッチ機能をアプリに実装しようとしています。推奨されていないことはわかっていますが、今のところその高精度は必要ありません。

ストップウォッチはスタートしますが、ストップウォッチを止めることができません。選択を押すと新しい画面に移動するように設定しました。

wind.on('click', 'select', function(e){
    var wind2 = new UI.Window();
    var textfield = new UI.Text({
      position: new Vector2(0, 0),
      size: new Vector2(144, 30),
      font: 'gothic-24-bold',
      text: 'Timer Started!',
      textAlign: 'center'
    });
    wind2.add(textfield);
    var textfield2 = new UI.Text({
       position: new Vector2(0, 60),
       size: new Vector2(144, 30),
       font: 'gothic-24-bold',
       text: 'PlaceHolder',
       textAlign: 'center'
     });
    wind2.add(textfield2);
    wind2.show();
    var timerID = 0;
    window.clearInterval(timerID);
    timerID = window.setInterval(function(){clockt(textfield2)},1000);

    wind2.on('click', 'select', function(e){
        timerID.clearInterval();
        var finaltime = convert(time1);
        seconds = pad(finaltime[0], 2);
        minutes = pad(finaltime[1], 2);
        var strfinaltime = "Total Time: \n" + hours + ":" + minutes + ":" + seconds +"\n" + time1
        var wind3 = new UI.Window();
        var textfield3 = new UI.Text({
            position: new Vector2(0, 50),
            size: new Vector2(144, 30),
            font: 'gothic-24-bold',
            text: strfinaltime,
            textAlign: 'center'
        });
        wind3.add(textfield3);
        wind3.show();
        time1 = 0;
    });
  });
4

1 に答える 1