For developers that are just getting started with webOS 3.0 and familiarizing themselves with our Enyo framework, the concept of encapsulation – a way to break your app down into smaller, self-contained parts – can make your code easier to understand and maintain.
Once an Enyo app is broken down into self-contained components, they need to be able to interact with each other to perform actions or expose and change properties they contain. In this blog post we will explore encapsulation using Enyo components and the methods that can be used to interact with them.
A simple example
Here is a simple Enyo application without encapsulation. The app will be modified to encapsulate some of its functionality later. The app is a timer that will show a progress bar increasing in value from 0% to 100% over the course of 10, 30 or 60 seconds. It also has radio buttons that determine the duration of the timer and a button to start the timer.