You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 30, 2019. It is now read-only.
Luke Pacholski edited this page Mar 6, 2014
·
14 revisions
Alright, so you're ready to re-invent the counter huh? That time-tested, honored and proven foundation of many a firework app - and you think you can do better? Awesome! Let's do some work...
1. Add an Attribute
Let's add an editable attribute to the counter called multiplier. It will be a number, with a minimum value of 1 and maximum value of 10. Later, we'll use it to multiply the current count. Make sure that this attribute is editable in the Appmaker designer by an app author, and that the value persists when you save and refresh the app. Set the default value to 2.
2. Add a Listener Method
Add a listener method called "Multiply Count". It will multiply the the current count by the multiplier attribute that you added earlier. Turn this listener on by default.
3. Add a Broadcast Method
Add a broadcast method to the Counter called Click.
4. Add a Click Handler
Add a click event to the component so that when it is clicked, it calls the Click broadcast method and broadcasts the current count. Use the special on-click shorthand.
5. Localize it
Add a french translation for the multiplier attribute that you added.