Yet Another Timer App - A hackable timer
Yata is a Timer App built on Electron, using Electron Forge. By default, it contains 4 pages: An alarm page, a reminder page, a task page, and a timer page. Furthermore, it can be extended to include other pages using Web Components.
Currently, Yata contains one configuration (useTray) that is automatically generated in src/userData/config.json. When enabled, Yata will close to tray when the window is closed instead of exiting. It is enabled by default in Windows and MacOS.
To customize src/index.html, modify src/css/index.css. To customize an individual component, modify the respective css src/components/somecomponent/somecomponent.css. To add a style that affects every (non-custom) component, as well as src/index.html, modify src/css/global.css.
Although it is possible to directly add HTML/CSS and JavaScript, Yata was created with Web Components in mind. To that end, a custom WebComponent class was created (located in src/utils/WebComponent.js), which is the base for all components in Yata.
The overall procedure to create a new WebComponent is the following:
-
Create a directory
src/components/your-component-name. -
Add 2 files in the newly created directory named
your-component-name.jsandyour-component-name.html. Optionally, add a third file namedyour-component-name.cssfor styling your component. -
In
your-component-name.html, add the desired HTML, nested in atemplatetag. You may also add CSSlinktags. -
In
your-component-name.js, create a class thatextends WebComponent. The base structure of the class should be the following:class YourComponentName extends WebComponent { constructor() { super('components/your-component-name/your-component-name.html'); // Declare which HTML file your component must use. // Your code here } async connectedCallback() { await super.connectedCallback(); // Load HTML file in the shadowRoot of the WebComponent. // Your code here } // Your methods here }More details regarding the shadowRoot can be found in Using shadow DOM.
-
After declaring your class, add
customElements.define('your-component-name', YourComponentName);. More details regarding customElements.define can be found here. -
Add a
scripttag in index.html that links toyour-component-name.js(make sure you adddeferto your script!). -
Finally, if your component is a page, you need to add a
buttontag in theheader, and ayour-component-nametag in thepage-viewdiv of index.html. Take note, that the order of the buttons corresponds with the order of the components, so the first button in theheadercorresponds with the first component in thepage-view, etc.
Before building Yata, please make sure you have Node and npm installed. If both are installed, you can do the following to build from source:
- Clone or download and extract this repository.
- Open a terminal, and
cdto the folder you have cloned or extracted this repository. - Run
npm installto download required dependencies. - Run
npm run maketo build Yata. This will create anoutdirectory with all the files required to install/run Yata.