Recently I was reminded again that we have an Expression Widget
The Expression Widget does client side execution of JavaScript.
Not all objects are enabled on it, but you can do some really powerful things with it.
2 Examples
1. Client side conversion of units - By doing this you can save on resources and load on the Server, imagine thousands of users accessing data that needs to be converted server side before sending it over to the Client. - Thanks Costin Badici for this approach.
2. Refresh your whole Mashup to have your new language tokens loaded. What if you want to have users be able to change their language preference on the fly? For the new language tokens to load, a full mashup/window refresh is needed. You can simply use location.reload() in the Expression Widget
Got more Client side code tips? Add them in the comments!
Well, would be good to have a better input method for Expression widget, as when you do complex Javascript operations it's cumbersome...
For instance I do language translations on the fly with expressions widget:
TW.Runtime.convertLocalizableString( '[[tokenName]]')