Skip to content
Selected things
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
example
.gitignore
LICENCE
Makefile
README.md
index.js
package.json

README.md

selectron

Keep track of the currently selected thing

Example

var selectron = require("selectron")

var sel = selectron()
    , ul = document.getElementById("list")

ul.addEventListener("click", function (evt) {
    if (evt.target.tagName === "LI") {
        sel.select(evt.target)
    }
})

sel.on("select", function (li) {
    li.classList.add("selected")
})

sel.on("unselect", function (li) {
    li.classList.remove("selected")
})

Installation

npm install selectron

Contributors

  • Raynos

MIT Licenced

Something went wrong with that request. Please try again.