UNPKG

@stimulus-library/controllers

Version:

A library of useful controllers for Stimulus

16 lines (15 loc) 517 B
import { BaseController } from "@stimulus-library/utilities"; import { useDirtyInputTracking } from "@stimulus-library/mixins"; export class DetectDirtyController extends BaseController { connect() { const element = this.el; const { restore } = useDirtyInputTracking(this, element); this._restore = restore; } restore(event) { event === null || event === void 0 ? void 0 : event.preventDefault(); if (this._restore) { this._restore(); } } }