Installation
1. Install from npm
For bundlers and ESM-capable runtimes, install the package from npm:
npm install histropediajs
2. Load the library
Use ESM imports with a bundler, or load the UMD build from a CDN for script-tag embeds.
import Histropedia, { Timeline, Dmy } from 'histropediajs';
const container = document.getElementById('timeline');
const timeline = new Timeline(container);
console.log(Histropedia.Timeline === Timeline);
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script>
const container = document.getElementById('timeline');
const timeline = new Histropedia.Timeline(container);
</script>
<script type="module">
import Histropedia, { Timeline, Dmy } from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/histropedia.esm.js';
const container = document.getElementById('timeline');
const timeline = new Timeline(container);
</script>
HistropediaJS is published as an ESM package for npm and bundlers. CommonJS
require('histropediajs') is not supported.
For non-module browser usage, use the UMD script-tag build shown above, or self-host
histropedia.umd.js / histropedia.umd.min.js.
TypeScript definitions are included with the npm package. The download bundle also includes
histropedia.esm.d.ts for direct ESM usage.
CDN URLs
For direct CDN imports, you can target the package default or a specific build file:
https://cdn.jsdelivr.net/npm/[email protected]
https://cdn.jsdelivr.net/npm/[email protected]/dist/histropedia.esm.js
https://cdn.jsdelivr.net/npm/[email protected]/dist/histropedia.umd.js
https://cdn.jsdelivr.net/npm/[email protected]/dist/histropedia.umd.min.js
Need More Help?
If you can't find what you're looking for, browse the examples or contact us.