The frontend/UI server, written in JS using the MarkoJS library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
437 B

  1. module.exports = class {
  2. onCreate() {
  3. this.state = {
  4. highlights: [],
  5. }
  6. }
  7. select(value) {
  8. this.emit("select", value)
  9. }
  10. toggleHighlight(id) {
  11. if (this.state.highlights.includes(id)) {
  12. this.state.highlights = this.state.highlights.filter(id2 => id2 !== id)
  13. } else {
  14. this.state.highlights = this.state.highlights.concat(id)
  15. }
  16. this.emit("hightlights", this.state.highlights);
  17. }
  18. }