universal groovy

13
Universal Groovy JCConf 2016 吳吳吳 pcbill

Upload: shin-jan-wu

Post on 09-Jan-2017

157 views

Category:

Presentations & Public Speaking


2 download

TRANSCRIPT

Universal GroovyJCConf 2016

吳欣展 pcbill

Isomorphic / Universal

Applications which run both client-side and server-side.

The backend and frontend share the same code.

Library (JAR)Groovy 2.3+(for traits) to javascript ECMA 5Apache 2 LicenseConverted code needs grooscript.jsTools: gradle, grails, npm/bower

Grooscript

WHY?You have all the Java tools and IDE’s

Don’t repeat code in 2 languages

Single development environment

Don’t learn another “to Javascript” tool

Static typed if you want to

Using Spock to test your codes

FUN !!!

LINKS

Website: http://grooscript.org

Documentation: http://grooscript.org/doc.html

Github: https://github.com/chiquitinxx/grooscript

Demos: https://github.com/chiquitinxx/grooscript-demos

Twitter @grooscript

Try live!: http://grooscript.org/conversions.html

Groovy

UI component

def <-> var

Expando <-> Javascript object

[ ] <-> [ ]

{ } <-> function() { }

HTML Builder

Javascript

form(id: 'addTodos') { h3 'TODO' ul { todos.each { li it } li { input(type: 'text', id: 'actualTodo', value: actualTodo) button { yield "Add #${todos.size() + 1}" } } } }

Reactjs?http://grooscript.org/react_example.html

Angularjs?https://devsoap.com/writing-angularjs-applications-in-groovy/

Q & A