Get started with chrono-node CDN

MIT licensed

The Chrono-Node library is a JS implementation for working with blockchain time and transactions.

Tags:
  • parser
  • time
  • npl
  • chrono

Stable version

Copied!

How to start using chrono-node CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with chrono-node CDN - cdnhub.io</title>
  <script src="https://cdn.cdnhub.io/chrono-node/2.7.5/chrono.min.js"></script>
</head>
<body>
  <button id="start">Start</button>
  <button id="stop">Stop</button>
  <div id="timer"></div>

  <script>
    const startButton = document.getElementById('start');
    const stopButton = document.getElementById('stop');
    const timer = document.getElementById('timer');
    let chrono;

    startButton.addEventListener('click', () => {
      chrono = new Chrono({
        template: 'M:S.MS',
        callbacks: {
          onProgress: (time, label) => {
            timer.textContent = time.toString();
          },
        },
      });
      chrono.start();
    });

    stopButton.addEventListener('click', () => {
      chrono.stop();
    });
  </script>
</body>
</html>

All versions