Download CK.wasm

Download canvaskit.wasm several times, see if the browser cache does its thing.

by David Iglesias

HTML

<button>
Download
</button>

<label>
<input type="checkbox" />
Fetch with credentials
</label>

JavaScript

const url = "https://unpkg.com/[email protected]/bin/canvaskit.wasm";
const btn = document.querySelector('button');
const box = document.querySelector('input');

btn.addEventListener('click', (_) => {
  if (btn.disabled) return;
  btn.disabled = true;

const withCredentials = box.checked;
  var options = withCredentials ? {
  	credentials: "same-origin"
  } : undefined;
  console.log(options);
  fetch(url, options).then((response) => {
    console.log(response.status);
    btn.disabled = false;
  });
});