cdransf / api-text

A web component to load text from an API and display it.

Home Page:https://www.npmjs.com/package/@cdransf/api-text

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

<api-text> web component

A web component to load text from an API and display it.

npm i @cdransf/api-text

Example usage

Add the api-text.js to your markup and define the necessary markup within your web component:

<script type="module" src="api-text.js"></script>
<api-text api-url="/api/now-playing">
  <p class="loading">🎧 Loading...</p>
  <p class="content"></p>
</api-text>

I use this component to load media data from a Netlify edge function and describe an earlier iteration in this blog post.

About

A web component to load text from an API and display it.

https://www.npmjs.com/package/@cdransf/api-text

License:MIT License


Languages

Language:JavaScript 100.0%