04-02-2018 05:49 - edited 04-02-2018 05:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

04-02-2018 05:49 - edited 04-02-2018 05:50
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I've got a couple of blocks in the index.js for the watch face I've been playing with that operate on the onclick event of a hidden <rect> to toggle the visibility of elements. It's not the tidiest way of doing it, but it was the only way I could get it working. Anyway, is there an easy way of tidying up this code block to run it as a function so I can call it from a util.toggler(arg1, arg2) - where arg1 and arg2 are the "ArcFrame" parts in the current code - type arrangement? (Very) Basic javascripting I can muddle through but function construction I'm still just at the starting blocks.
if (stepArcFrame.style.display == "inline" && calArcFrame.style.display == "none") { stepArcFrame.style.display = "none"; calArcFrame.style.display = "inline"; } else { stepArcFrame.style.display = "inline"; calArcFrame.style.display = "none"; } }

04-25-2018 14:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


04-25-2018 14:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Something like this?
// util.js Toggle Show/Hide export function toggler(ele) { ele.style.display = (ele.style.display === "inline") ? "none" : "inline"; }// index.jsimport * as util from "util";
util.toggler(stepArcFrame);
util.toggler(calArcFrame);

