Sha256: 732de0b582b614e3749d332e641f731e9255d429b4b41534f67ca9cd01383e24

Contents?: true

Size: 502 Bytes

Versions: 12

Compression:

Stored size: 502 Bytes

Contents

import { Controller } from "@hotwired/stimulus"
import { debounce } from "helpers"

export default class extends Controller {
  static values = {
    debounceTimeout: { type: Number, default: 300 }
  }

  initialize() {
    this.debouncedSubmit = debounce(this.debouncedSubmit.bind(this), this.debounceTimeoutValue)
  }

  submit(event) {
    const form = event.target.form || event.target.closest("form")
    if (form) form.requestSubmit()
  }

  debouncedSubmit(event) {
    this.submit(event)
  }
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mission_control-jobs-0.6.0 app/javascript/mission_control/jobs/controllers/form_controller.js
mission_control-jobs-0.5.0 app/javascript/mission_control/jobs/controllers/form_controller.js
mission_control-jobs-0.4.0 app/javascript/mission_control/jobs/controllers/form_controller.js
mission_control-jobs-0.3.3 app/javascript/mission_control/jobs/controllers/form_controller.js
mission_control-jobs-0.3.2 app/javascript/mission_control/jobs/controllers/form_controller.js
mission_control-jobs-0.3.1 app/javascript/mission_control/jobs/controllers/form_controller.js
mission_control-jobs-0.3.0 app/javascript/mission_control/jobs/controllers/form_controller.js
mission_control-jobs-0.2.2 app/javascript/mission_control/jobs/controllers/form_controller.js
mission_control-jobs-0.2.1 app/javascript/mission_control/jobs/controllers/form_controller.js
mission_control-jobs-0.2.0 app/javascript/mission_control/jobs/controllers/form_controller.js
mission_control-jobs-0.1.1 app/javascript/mission_control/jobs/controllers/form_controller.js
mission_control-jobs-0.1.0 app/javascript/mission_control/jobs/controllers/form_controller.js