@stimulus-library/controllers
Version:
A library of useful controllers for Stimulus
15 lines (14 loc) • 486 B
JavaScript
import { BaseController } from "@stimulus-library/utilities";
import { useDirtyFormTracking } from "@stimulus-library/mixins";
export class DetectDirtyFormController extends BaseController {
connect() {
const { restore } = useDirtyFormTracking(this, this.el);
this._restore = restore;
}
restore(event) {
event === null || event === void 0 ? void 0 : event.preventDefault();
if (this._restore) {
this._restore();
}
}
}