# elasticpress/4.4.1/assets/js/status-report/index.js

ElasticPress, version 4.4.1. 52 lines.

- Page: https://pluginprobe.com/plugins/elasticpress/4.4.1/code/assets/js/status-report/index.js
- Raw: https://pluginprobe.com/plugins/elasticpress/4.4.1/raw/assets/js/status-report/index.js
- Modified: 2022-11-29T18:22:08+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/elasticpress/4.4.1/code/assets/js/status-report/index.js#L10-L20`.

```javascript
/* global ClipboardJS */

/**
 * WordPress dependencies.
 */
import domReady from '@wordpress/dom-ready';
import { render } from '@wordpress/element';

/**
 * Internal dependencies.
 */
import { reports } from './config';
import Reports from './components/reports';

/**
 * Status report copy button.
 *
 * @returns {void}
 */
const init = () => {
	const report = document.getElementById('ep-status-reports');
	const clipboard = new ClipboardJS('#ep-copy-report');

	/**
	 * Handle successful copy.
	 *
	 * @param {Event} event Copy event.
	 * @returns {void}
	 */
	const onSuccess = (event) => {
		event.trigger.nextElementSibling.style.display = 'initial';

		setTimeout(() => {
			event.trigger.nextElementSibling.style.display = 'none';
		}, 3000);

		event.clearSelection();
	};

	/**
	 * Bind copy button events.
	 */
	clipboard.on('success', onSuccess);

	/**
	 * Render reports.
	 */
	render(<Reports reports={reports} />, report);
};

domReady(init);

```
