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

Firefox OS勉強会 4th Untitled

masawada
October 16, 2013

Firefox OS勉強会 4th Untitled

masawada

October 16, 2013
Tweet

More Decks by masawada

Other Decks in Technology

Transcript

  1. ໊শະઃఆ 2013.10.16 Firefox OSษڧձ 4th @masawada

  2. Έͳ͞Μ

  3. ͜Μ͹Μ͸

  4. masawada

  5. None
  6. ࣗݾ঺հ • ిؾ௨৴େֶ ৘ใཧ޻ֶ෦ ৘ใɾ௨৴޻ֶՊ 2೥ • ΤϦΞϫϯηάͱ͔ • Rubyͱ͔JavaScriptͱ͔

  7. masawada.me

  8. FxOS & Win8 ϋοΧιϯ

  9. αΠίʔ αΠίʔ

  10. ຊ୊

  11. ໊শະઃఆ 2013.10.16 Firefox OSษڧձ 4th @masawada

  12. None
  13. None
  14. ؒʹ߹Θͳ͔ͬͨ

  15. Twitter

  16. ΈΜͳ

  17. ͍͖ͩ͢

  18. Twitter

  19. None
  20. 2013/10/16 17:43

  21. ϋογϡλά

  22. #FxOS

  23. ͝ҙݟɾ࣭໰

  24. #FxOS

  25. Twitter

  26. TwitterΫϥΠΞϯτ Λ࡞Ζ͏

  27. TwitterΫϥΠΞϯτ͸ ࣍ੈ୅ͷHello, world

  28. Hello, world TwitterΫϥΠΞϯτ ςΩετೖྗ × ˕ ςΩετग़ྗ ˕ ˕ ը૾දࣔ

    ˚ ◦ Ϧετදࣔ ˚ ◦ ωοτϫʔΩϯά × ˕
  29. ి௨େੜ͸ࡏֶதʹ1౓͸ TwitterΫϥΠΞϯτΛ࡞Δ

  30. None
  31. None
  32. TwitterΫϥΠΞϯτ Λ࡞Ζ͏

  33. Twitter Libraries

  34. None
  35. None
  36. Node.js޲͚ͬΆ͍

  37. Cross Origin੍ݶ͕ ݪҼʁ

  38. →࡞Ζ͏

  39. Ͱ͖·ͨ͠

  40. Firefox OS޲͚ Twitter APIϥΠϒϥϦ

  41. Violet.js

  42. ۩ମతʹԿ͕ Firefox OS޲͚ʁ

  43. // XHR var xhr = new XMLHttpRequest({mozSystem: true}); // manifest.webapp

    "type": "privileged", "permissions": { “systemXHR”: {} }
  44. violet.js • ΄ͱΜͲͷAPIΤϯυϙΠϯτʹରԠ → (ະςετ…) • Firefox OSΞϓϦͱͯ͠࢖͏ʹ͸ systemXHRͷݖݶΛཁٻ͢Δඞཁ͕͋Δ

  45. ͜͜·Ͱ͕ ࠓ೥7݄ͷͰ͖͝ͱ

  46. FxOS & Win8 ϋοΧιϯ

  47. 8/10

  48. FoxBird

  49. σϞ

  50. FoxBird • OAuth: PIN Only • Tweet (statuses/update) • Favorite

    • Retweet • Streaming API (GET user)
  51. ॏࢹͨ͜͠ͱ

  52. Streaming APIରԠ

  53. Streaming APIपΓΛ ղઆ

  54. Streaming API͸ ԿΛ΍͍ͬͯΔͷ͔

  55. REST

  56. None
  57. Streaming API

  58. None
  59. ίωΫγϣϯΛ ੾அ͠ͳ͍

  60. src/streaming.js

  61. var con = Violet.HTTPClient({ method: method, uri: uri }); con.onloading

    = function(xhr){ ... };
  62. src/http.js

  63. var xhr = new XMLHttpRequest({mozSystem: true}); // தུ xhr.onreadystatechange =

    function(){ if(xhr.readyState === 3){ this.onloading(xhr); }else if(xhr.readyState === 4){ if(xhr.status === 200){ this.onsuccess(xhr); }else{ this.onerror(xhr); } } }.bind(this);
  64. SFBEZ4UBUFͷ஋ͷϦετ͸ҎԼͷΑ͏ʹͳΓ·͢ɻ ɾ ॳظԽ͞Ε͍ͯ·ͤΜ ɾ ಡΈࠐΈதͰ͢ ɾ ಡΈࠐΈ͸׬ྃ͠·ͨ͠ ɾ ૒ํ޲ʹѻ͑·͢ ɾ

    ͢΂ͯ׬ྃ͠·ͨ͠
  65. SFBEZ4UBUFͷ஋ͷϦετ͸ҎԼͷΑ͏ʹͳΓ·͢ɻ ɾ ॳظԽ͞Ε͍ͯ·ͤΜ ɾ ಡΈࠐΈதͰ͢ ɾ ಡΈࠐΈ͸׬ྃ͠·ͨ͠ ɾ ૒ํ޲ʹѻ͑·͢ ɾ

    ͢΂ͯ׬ྃ͠·ͨ͠
  66. readyState === 3ͷͱ͖ ߋ৽ΞϦ

  67. var con = Violet.HTTPClient({ method: method, uri: uri }); con.onloading

    = function(xhr){ var lines = xhr.responseText.split('\r\n'); if(!lines[lines.length-2]){ return false; } callback(JSON.parse(lines[lines.length-2])); };
  68. Streaming APIରԠ

  69. violet.jsΛ࢖ͬͯΈΔ

  70. ΫϥΠΞϯτΛ ࡞ͬͯΈΔ

  71. ΫϥΠΞϯτΛ࡞Δ • πΠʔτػೳ • Streaming APIͰλΠϜϥΠϯಡΉ • UI͸Building BlocksΛ࢖͏

  72. σϞ

  73. ؆୯ʹ࡞ΕΔ

  74. ௒ߴ଎։ൃͰ͖Δ

  75. [௒ߴ଎։ൃ][Google ݕࡧ]

  76. ੋඇ ࢖ͬͯΈ͍ͯͩ͘͞

  77. ࠷ޙʹ

  78. v0.2.0

  79. v0.2.0ͷ৽ػೳ • POST statuses/filterʹରԠ • ൐ͬͯstreaming͸deprecated • userstreamʹͳΓ·ͨ͠ • v0.3.0Ͱফ͑·͢

    • POST statuses/update_with_mediaʹରԠ
  80. ΋͏͙͢ϦϦʔε

  81. ͋Γ͕ͱ͏͍͟͝·ͨ͠