Sha256: fe2bfb1c5c0349c512b635c173dd17f0c729e0aef2290dae3127db9f4fc7d8e9

Contents?: true

Size: 733 Bytes

Versions: 1

Compression:

Stored size: 733 Bytes

Contents

<% if @serve_static %>
const data = <%= JSON.generate(@values) %>;
<% else %>
(async () => {
  const data = await (await fetch("/values")).json();
  const suggestions = await (await fetch("/suggestions")).json();

  const suggestHTML = suggestions.map(sugg => `<tr><td>${sugg.file_path}</td><td>${sugg.x}</td><td>${Math.round(sugg.y)}</td><td>${Math.round(sugg.x * sugg.y)}</td></tr>`).join();
  document.querySelector("#suggestions-table").innerHTML = suggestHTML;
<% end %>

  const svg = chart(data);

<% if @serve_static %>
document.addEventListener('DOMContentLoaded', () => {
  document.querySelector('#graph').appendChild(svg.node());
});
<% else %>
  document.querySelector('#graph').appendChild(svg.node());
})();
<% end %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attractor-0.3.4 app/assets/javascripts/index.js.erb