Skip to content
  1. Extras
  2. FetchIt
  3. Popup notifications
  4. Notiflix.Notify

Notiflix.Notify

This section shows how to integrate the Notiflix library (pure JavaScript) and its Notify tool.

  • For variety we import the script and styles from CDN and set FetchIt.Message as follows:
html
<script type="module">
  import Notiflix from 'https://cdn.jsdelivr.net/npm/notiflix@3/+esm';

  document.addEventListener('DOMContentLoaded', () => {
    FetchIt.Message = {
      success(message) {
        Notiflix.Notify.success(message);
      },
      error(message) {
        Notiflix.Notify.failure(message);
      },
    }
  });
</script>
  • Or in your own script file with the defer attribute; then you do not need the DOMContentLoaded handler and have direct access to the FetchIt class:
js
import Notiflix from 'https://cdn.jsdelivr.net/npm/notiflix@3/+esm';

FetchIt.Message = {
  success(message) {
    Notiflix.Notify.success(message);
  },
  error(message) {
    Notiflix.Notify.failure(message);
  },
}

Done! With these steps we integrate Notiflix.Notify.