Skip to content

Instantly share code, notes, and snippets.

View songjiz's full-sized avatar
🧑‍💻

songji zeng songjiz

🧑‍💻
View GitHub Profile
import { Controller } from "stimulus";
import { get } from "@rails/request.js";
import { PageSnapshot } from "@hotwired/turbo";
export default class extends Controller {
static values = { hoverTime: Number };
connect() {
this.element.addEventListener("mouseover", this.prefetch.bind(this));
this.element.addEventListener("touchstart", this.prefetch.bind(this));
}