Upgrade to Pro — share decks privately, control downloads, hide ads and more …

実践Isomorphic(+ Electron)

実践Isomorphic(+ Electron)

isormorphic meetupの資料です

Koutarou Chikuba

April 30, 2015
Tweet

More Decks by Koutarou Chikuba

Other Decks in Programming

Transcript

  1. ؀ڥґଘAPI ☞ document / navigator ☞ setImmediate / requestAnimationFrame ☞

    ϙϦϑΟϧ͕ͳ͍ωΠςΟϒϞδϡʔϧ΁ͷrequire(http΍vm) ☞ etc...
  2. ES6 moduleͲ͏͢Δʁ ☞ import / export ☞ কདྷతʹͬͪ͜?(node͕node_modulesΛͲ͏ѻ͏͔ܾ·ͬͯͳ ͍) ☞

    babel͸requireܗࣜʹม׵͢Δ ☞ typescriptͷ --target commonjs ͸export default ະରԠ
  3. Isomorphic for V8 ctx = V8::Context.new ctx.eval """ var global

    = {}; """ ctx.eval $react_source ctx.eval """ var React = global.React; """ V8 binding͋Ε͹ଞͷݴޠͰ΋͍͚Δ
  4. ࠓಈ͍ͨίʔυ # it will respond to https://localhost:3000/api/user/fuga?foo=bar proxy.get '/user/:id', ({id},

    {foo}, req) -> {id, foo} # Return with promise proxy.post '/post', ({}, body) -> new Promise (done) -> setTimeout -> done {type: 'this is post:'+params.prop} , 300