scinote-web/app/assets/javascripts/shared/autosave_form.js

12 lines
293 B
JavaScript
Raw Normal View History

2021-05-22 20:41:56 +08:00
(function() {
2021-04-18 23:19:16 +08:00
'use strict';
function initAutosaveListeners() {
$(document).on('change', 'form[data-action*="autosave-form"]', function({ currentTarget }) {
2021-05-02 17:36:10 +08:00
$.rails.fire($(currentTarget), 'submit');
2021-05-22 20:41:56 +08:00
});
2021-04-18 23:19:16 +08:00
}
$(document).one('turbolinks:load', initAutosaveListeners);
2021-05-02 17:36:10 +08:00
}());