Sha256: 76a0d4ff4548a285dd1c2e24e7f1fbd013f50e9cb50c012dd006ac535a1723fc

Contents?: true

Size: 445 Bytes

Versions: 5

Compression:

Stored size: 445 Bytes

Contents

import { Controller } from "@hotwired/stimulus";

export default class extends Controller {
  static targets = ["field"];

  clear() {
    this.eventTarget.value = null;
    window.dispatchEvent(new CustomEvent("search-controller:submit", {}));
  }

  submit(event) {
    event.preventDefault();

    if (event.key === "Enter" || event.type === "click") {
      window.dispatchEvent(new CustomEvent("search-controller:submit", {}));
    }
  }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_mini_profiler-0.7.3 app/javascript/js/search_controller.js
rails_mini_profiler-0.7.2 app/javascript/js/search_controller.js
rails_mini_profiler-0.7.1 app/javascript/js/search_controller.js
rails_mini_profiler-0.7.0 app/javascript/js/search_controller.js
rails_mini_profiler-0.6.0 app/javascript/js/search_controller.js