Date post: | 13-Jan-2015 |
Category: |
Documents |
Upload: | oleg-podsechin |
View: | 1,088 times |
Download: | 1 times |
RingoJSFinJUG talk byOleg Podsechin15.01.2013
Overview started by Hannes Wallnöfer
successor to Helma, HelmaNG
o been in development for 13+ years
runs on the JVM
uses Mozilla Rhino
conforms to CommonJS
CommonJS
Modules/1.0, Modules/1.1
JSGI
Binary
Filesystem
System
Unit Testing
Features
hot reloading of modules
profiler
debugger
sandboxing
runs anywhere Java runs
within a webapp container
standalone process
Install & Run
git clone git://github.com/ringo/ringojs.gitant update jarbin/ringo
Hello World
>> 'Hello World'Hello World
Hello World, Take Two
new require('ringo/httpserver').Server({ app: function() { return {status: 200, headers: {}, body: ['Hello World']}; }}).start();
Multithreaded JS// run "test" in "threads" parallel threads a total of "count" timesfunction parallel(test, count, threads) { var pool = new
java.util.concurrent.Executors.newFixedThreadPool(threads); function runnable(f) { return new java.lang.Runnable({ run: function() { try { f(); } catch(e) { } }}); } for(var i = 0; i < count; i ++) pool.execute(runnable(test));}
RingoJS libraries search GitHub for ringo-
ringo-admin install user/repo
use rp and packages.ringojs.orgrp install name
Examples of RingoJS libraries
stick
ringo-modulr
ringo-storable
ringo-filestore, ringo-hibernate
ringo-mongodb
ringo-mail
Stick Examplevar {Application} = require("stick");
var app = Application();
app.configure("error", "notfound", "route");var response = require('ringo/jsgi/response');
app.get("/", function(req) { return response.html("Hello");});
Community
#ringojs on Freenode IRC
#ringojs & @ringojs on Twitter
http://github.com/ringo
Use Cases & Benefits
standalone
to extend an existing Java webapp
plugin architecture for existing application
code reuse between server and browser
less context switching
more compact code, faster prototyping
Extras
Common Node
Nashorn
Node.jar
Vert.x
@olegpodsechingithub.com/olegp