unpkg CDN sanity check

This page loads the guarded definition helper from unpkg. Importing it registers the default tag; the helper is safe to call again. This example requires an npm publication.

Import and call the registration helper

<script type="module">
  import { defineScriptDependent } from
    'https://unpkg.com/@aarongustafson/script-dependent@latest/define.js?module';
  defineScriptDependent();
</script>

<label for="draft">Your draft</label>
<textarea id="draft"></textarea>
<script-dependent script="./word-count.js" hidden>
  <button type="button">Count words</button>
  <p>Words: <output aria-live="polite">0</output></p>
</script-dependent>