Sha256: ca41296a98c9ee7af3210be78d303096f15ad00160e5a732fcd16037aba43c24
Contents?: true
Size: 502 Bytes
Versions: 35
Compression:
Stored size: 502 Bytes
Contents
export default function createNavStore(Alpine) { return { open: Alpine.$persist([]).as("nav-open"), active: Alpine.$persist(null).as("nav-active"), isOpen(id) { return this.open.includes(id); }, setOpen(id) { this.open.push(id); }, setClosed(id) { const index = this.open.indexOf(id); if (index > -1) { this.open.splice(index, 1); } }, toggle(id) { this.isOpen(id) ? this.setClosed(id) : this.setOpen(id); }, }; }
Version data entries
35 entries across 35 versions & 1 rubygems