Files
fizzy/app/javascript/controllers/touch_placeholder_controller.js

17 lines
368 B
JavaScript

import { Controller } from "@hotwired/stimulus"
import { isTouchDevice } from "helpers/platform_helpers"
export default class extends Controller {
static get shouldLoad() {
return isTouchDevice()
}
static values = { placeholder: String }
connect() {
if (this.hasPlaceholderValue) {
this.element.placeholder = this.placeholderValue
}
}
}