100311 Dev Fest2010

Post on 15-Jan-2015

1.200 views 2 download

description

 

Transcript of 100311 Dev Fest2010

5 分でできる、html5 CRUD appl.Web Messaging rpc meets Ruby

on Rails♪2010.3.11(thu) Google DevFest 2010

小松 けんさく(こまっしゅ)http://twitter.com/komasshu

自己紹介

勤務先: NTT Communications Corp.

Community : html5-developers-jp› Web SQL Database› Web Sockets› …

“Web Workers は、

革命だ”Shumpei Shiraishi

(2010.2.19 @ developer’s summit 2010)

Web Messaging rpc

http://www.slideshare.net/shumpei/html5-web-messagingweb

fine♪

調べてみた

http://code.google.com/p/web-messaging-rpc/

Great!!

Bye-bye spaghetti!!

あまりにも

感動したので・・

コミッターになりました ww

はじめの一歩

Rails に組み込んでみました。

UIlayer

BLlayer

ActionController

ActiveRecord DB

Create

Retrieve

Update

Delete

Html5(web messaging rpc) Ruby on Rails

Html5 meets Rails!!Html5 meets Rails!!

早速Demoww

これだけ恐るべし WMR + Rails

$ rails sample$ cd sample$ mkdir lib/generators$ cp -r ../wmr_komasshold lib/generators/$ ruby script/generate wmr_komasshold bookservice title:string price:integer author:string$ rake db:migrate$ ruby script/server

BL 層 (Worker) のコードはこんな感じno postmessage & onmessage

importScripts("/javascripts/webrpc.js");

new webrpc.Service("model", { find: function(obj) { // Retrieve var req = new XMLHttpRequest(); req.open("GET", "/"+obj.plural+".json", false);

recv = req.send();

if(req.status == 200) return eval("("+req.responseText+")"); else return null; },

今週末 commit 予定よろしければ試してみて下さい

http://code.google.com/p/web-messaging-rpc/