Geertjan's Blog

  • April 21, 2015

Mapping Knockout.js Concepts to Java

Geertjan Wielenga
Product Manager

Here's a table that should help you when expressing your JavaScript-based Knockout.js applications in Java via DukeScript.

Knockout.js DukeScript Example
Observable property @Property
@Property(name = "itemToAdd", type = String.class)
Observable array property @Property with 'array' attribute
@Property(name = "items", type = String.class, array = true)
Computed property @ComputedProperty
static String fullName(String firstName, String lastName) {
return firstName + " " + lastName;
Function @Function
static void addItem(Data model) {
String itemToAdd = model.getItemToAdd();
List items = model.getItems();
if (itemToAdd!=null&&itemToAdd.length()>0){

Want to see the above in action? Watch this new screencast created today:

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.