fy-docs 0.1.3

Cargo subcommand for building and previewing Typst specification documents
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// fy-docs live reload: reload the page when the served build id changes.
(function poll() {
  if (document.visibilityState === 'hidden') {
    return setTimeout(poll, 1500);
  }
  fetch('_build', { cache: 'no-store' })
    .then(function (response) { return response.text(); })
    .then(function (id) {
      if (window.__fyBuild === undefined) {
        window.__fyBuild = id;
      } else if (window.__fyBuild !== id) {
        return location.reload();
      }
      setTimeout(poll, 1500);
    })
    .catch(function () { setTimeout(poll, 3000); });
})();