mirror of
https://github.com/wallabag/wallabag.git
synced 2026-11-16 05:25:38 +01:00
Guard `Waves.init()` behind a module-level flag so the Materialize body-level listener setup runs only once per loaded JavaScript runtime. Waves does not expose a matching teardown API, so one-time initialization is the smallest way to prevent duplicate ripple listeners after reconnects.
14 lines
314 B
JavaScript
14 lines
314 B
JavaScript
import { Controller } from '@hotwired/stimulus';
|
|
|
|
let hasInitializedWaves = false;
|
|
|
|
export default class extends Controller {
|
|
// eslint-disable-next-line class-methods-use-this
|
|
connect() {
|
|
if (window.Waves && !hasInitializedWaves) {
|
|
window.Waves.init();
|
|
hasInitializedWaves = true;
|
|
}
|
|
}
|
|
}
|