openfoodfoundation/openfoodnetwork

View on GitHub
app/webpacker/controllers/ephemeral_controller.js

Summary

Maintainability
A
0 mins
Test Coverage
import { Controller } from "stimulus";

export default class extends Controller {
  connect() {
    setTimeout(this.fadeout, 1500);
  }

  fadeout = () => {
    this.element.classList.add("animate-hide-500");
    setTimeout(this.remove, 500);
  };

  remove = () => {
    this.element.remove();
  };
}