InstallationGetting Started

Install the package or load a browser build, then choose the module format that fits your project.

Installation

1. Install from npm

For bundlers and ESM-capable runtimes, install the package from npm:

Shell
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.

JavaScript
import Histropedia, { Timeline, Dmy } from 'histropediajs';

const container = document.getElementById('timeline');
const timeline = new Timeline(container);

console.log(Histropedia.Timeline === Timeline);

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:

Text
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.