Sha256: 0bd36da347817a4cc336fd7c1a3093cb438dbebe506c7e9528e23921d3c7bca0
Contents?: true
Size: 597 Bytes
Versions: 26
Compression:
Stored size: 597 Bytes
Contents
import { Controller } from "@hotwired/stimulus"; export default class PagyNavController extends Controller { connect() { document.addEventListener("shortcut:page-prev", this.prevPage); document.addEventListener("shortcut:page-next", this.nextPage); } disconnect() { document.removeEventListener("shortcut:page-prev", this.prevPage); document.removeEventListener("shortcut:page-next", this.nextPage); } nextPage = () => { this.element.querySelector("a:last-child").click(); }; prevPage = () => { this.element.querySelector("a:first-child").click(); }; }
Version data entries
26 entries across 26 versions & 1 rubygems