UMD | CommonJS | ES Module | |
---|---|---|---|
File | listenable-data.umd.js | listenable-data.cjs.js | listenable-data.esm.js |
UMD builds can be used directly in the browser via a <script>
tag. The default file from jsDelivr CDN at https://www.jsdelivr.com/gh/elementumjs/listenable-data is the UMD build (listenable-data.umd.js
).
- index.html
<script src="index.js"></script>
- index.js
// ...
const data = new Data(source);
CommonJS builds are intended for use with older bundlers like browserify or webpack 1. The default file for these bundlers (pkg.main
) is the CommonJS build (listenable-data.cjs.js
).
- index.html
<script src="index.js"></script>
- index.js
const Data = require("elementum/listenable-data");
// ...
const data = new Data(source);
ES Module builds are intended for use with modern bundlers like webpack 2 or rollup. The default file for these bundlers (pkg.module
) is the ES Module build (listenable-data.esm.js
).
- index.html
<script src="index.js" type="module"></script>
- index.js
import Data from "@elementumjs/listenable-data";
// ...
const data = new Data(source);
Install via npm
:
npm install @elementumjs/listenable-data