Upgrading to v1.8Guide

Migrate style reads, compact data, article ordering and image origin allowlists from HistropediaJS v1.7.

Upgrading from v1.7 to v1.8

Check these four behaviours when moving an existing timeline to v1.8.

Read an override or a resolved style

A path-only style getter returns the value set on that model. An inherited or cleared path returns undefined. This applies to article, lane, chart and time-band styles, including article hover and active overrides.

JavaScript
timeline.setOption('article.defaultStyle.width', 242);
article.setStyle('width', 300);
article.setStyle('width');  // 300
article.setStyle('width', Histropedia.UNSET);
article.setStyle('width');  // undefined
article.style.width;  // 242 when no lane overrides it
article.getCurrentStyle().width;  // includes hover or active styling

Use model.style for resolved normal values. On an article, hoverStyle and activeStyle expose the resolved interaction styles. A path-only setHoverStyle() now reads from the article's hover overrides. You can remove workarounds for the v1.7 getter reading active styles. Use getWidth() for the measured card width when the style is 'auto'.

Read compact input through canonical fields

You can keep loading compact records. Read the resulting model through its canonical field names or a path getter. A supplied alias takes precedence over defaults. A defined canonical field takes precedence over its alias in the same record or update.

JavaScript
timeline.load([{ i: 'voyage', t: 'Voyage', fy: 1901, ty: 1903 }]);
const voyage = timeline.getArticleById('voyage');
voyage.data.title;  // 'Voyage'
voyage.setOption('t');  // 'Voyage'
voyage.setOption('ty', 1904);
voyage.data.to.year;  // 1904

Article aliases include i/t/s/r for ID, title, subtitle and rank, m/ln for image URL and lane, st/ast for normal and active styles, and p/h/hp for ongoing periods, filtering and hidden period lines. The f and t date prefixes accept y, m, d, hr, mi, s, ms, p for year through precision. Time bands normalize the aliases for fields they support.

Use starred, offsetLeft and offsetTop for the initial star and offsets. Both v1.7.0 and v1.8.0 ignore v, ol and ot for those input properties. Also use the full names for hoverStyle, cardLayout and time-band visibility.

Saved viewport state has its own format. In getStatusForSave() article records, t and l represent vertical and horizontal offsets.

Pass a complete article order

Pass every loaded ID exactly once to reorderArticles(ids), with the topmost card last. An unknown, missing or duplicate ID throws before the order or selection changes. Number and string IDs are distinct.

// With only 'launch' and 'landing' loaded:
timeline.reorderArticles(['landing', 'launch']); // draw 'launch' on top
timeline.removeArticleById('landing');  // remove a card explicitly

Use the final image URL with an origin allowlist

When using the built-in image.sanitizer.allowedOrigins list, supply the final asset URL and configure the image host to allow cross-origin reads. A redirect fails even between two allowed hosts, including in 'img' decode mode. If a site previously supplied redirecting thumbnail links, update the stored URLs.

See the origin matching rules and image error and idle events.

Need More Help?

If you can't find what you're looking for, browse the examples or contact us.