12-24-2017 14:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-24-2017 14:34
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
When your app has more than one screen, you will need to follow some simple programming conventions to prevent the mess. Here's what I created for my app. The View pattern looks like this:
import { $at } from './view'
const $ = $at( '#timer' ); class Timer extends View { el = $(); onMount(){ clock.granularity = "seconds"; clock.ontick = this.onTick; } ticks = 0; onTick = () => { this.ticks++; this.render(); }
minutes = $( '#minutes' );
seconds = $( '#seconds' ); render(){
const { ticks } = this; this.minutes.text = Math.floor( ticks / 60 ); this.seconds.text = ( ticks % 60 ).toFixed( 2 ); } onUnmount(){ clock.granularity = "off"; clock.ontick = null; } }
Feel free to use, I shared it under MIT license.
https://github.com/gaperton/ionic-views

12-28-2017 07:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
12-28-2017 07:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Would be nice if you add it to the Ionic OSS repository list.

12-28-2017 08:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

12-28-2017 08:47
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Of course. Here's the pull request. https://github.com/Fitbit/ossapps/pull/7
01-02-2018 07:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
01-02-2018 07:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Merged, thanks @gaperton!

