gitcoinco/code_fund_ads

View on GitHub
app/javascript/controllers/organization_users_search_controller.js

Summary

Maintainability
A
0 mins
Test Coverage
import { debounce } from 'lodash'
import ApplicationController from './application_controller'

export default class extends ApplicationController {
  static targets = ['query', 'activity', 'found']

  connect () {
    super.connect()
    this.perform = debounce(this._perform, 350).bind(this)
  }

  beforePerform () {
    this.activityTarget.hidden = false
    this.foundTarget.hidden = true
  }

  _perform (event) {
    event.preventDefault()
    this.stimulate(
      'OrganizationUsersSearchReflex#perform',
      this.queryTarget.value
    )
  }
}