@financial-times/o-autoinit

Provides a standard way of firing the 'o.DOMContentLoaded' events if/when the equivalent browser-native events fire, to auto initialise other components that are in use.

Usage no npm install needed!

<script type="module">
  import financialTimesOAutoinit from 'https://cdn.skypack.dev/@financial-times/o-autoinit';
</script>

README

o-autoinit MIT licensed

Auto initalise Origami components

This component comprises a standard way of firing the o.DOMContentLoaded event when the equivalent browser-native event fire, and will fire the Origami events even if the native ones have already been and gone, making this suitable for bundling with components that are loaded asyncronously.

Usage

o-autoinit is included automatically by the Origami Build Service. Manual build users may include o-autoinit to initialise Origami components but it is not the only option. See the component initialisation documentation for more information.

JavaScript

import 'o-autoinit';

The autoinit component must be imported after all components that bind to the initialisation events. If it is required more than once, subsequent requires will not have any effect, and the initialisation events may be emitted as early as the first require point.

Migration

State Major Version Last Minor Release Migration guide
✨ active 3 N/A migrate to v3
⚠ maintained 2 2.0.7 migrate to v2
╳ deprecated 1 1.5 N/A

Contact

If you have any questions or comments about this component, or need help using it, please either raise an issue, visit #origami-support or email Origami Support.


Licence

This software is published by the Financial Times under the MIT licence.