CDN Setup

Some tools may not support NPM bundling capabilities. For these cases, Despia has added CDN support to ensure compatibility with any development environment or platform.

Standard CDN Import

To use Despia Native via CDN with a standard script tag, add the following to your HTML:

<script src="https://cdn.jsdelivr.net/npm/despia-native/index.min.js"></script>

ES Module Import

For modern JavaScript applications that use ES modules, you can import Despia Native directly:

<script type="module">
  import despiaNative from 'https://cdn.jsdelivr.net/npm/despia-native/+esm'
</script>

Programmatic Loading for Special Cases

Some development tools may not allow you to import CDN packages via static HTML code, requiring instead that scripts be loaded programmatically via JavaScript. So far, the only known platform that requires this setup is Base44.

To load the Despia Native script programmatically, use the following JavaScript code:

let s = document.createElement('script');
s.src = 'https://cdn.jsdelivr.net/npm/despia-native/index.min.js';
s.onload = () => console.log('Despia Native loaded');
document.head.appendChild(s);

This approach dynamically creates a script element, sets the source to the CDN URL, and appends it to the document head, ensuring the library loads properly in environments with restrictions on static script tags.

Updated on