PageSourceSearch

https://assets.scansail.com/frontend-assets/master/sf-assets/controllers/dismissible_controller-AP0niFL.js

js scansail.com collected 2026-10-09 23:17:52 UTC 848 bytes, 36 lines download raw bytes

1/* stimulusFetch: 'lazy' */
2import { Controller } from "@hotwired/stimulus";
3
4/**
5 * Dismissible Controller
6 *
7 * Gère les éléments pouvant être fermés (banners, notifications, alerts).
8 * Contrairement à @stimulus-components/notification :
9 * - delay=0 signifie "ne jamais fermer automatiquement"
10 *
11 * Usage:
12 *   <div data-controller="dismissible" data-dismissible-delay-value="0">
13 *     <button data-action="click->dismissible#dismiss">Close</button>
14 *   </div>
15 */
16export default class extends Controller {
17  static values = {
18    delay: { type: Number, default: 0 },
19  };
20
21  connect() {
22    if (this.delayValue > 0) {
23      this.timeout = setTimeout(() => this.dismiss(), this.delayValue);
24    }
25  }
26
27  disconnect() {
28    if (this.timeout) {
29      clearTimeout(this.timeout);
30    }
31  }
32
33  dismiss() {
34    this.element.remove();
35  }
36}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.