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

Riot.js v3 Migration道

yuuki79
February 02, 2017

Riot.js v3 Migration道

AMESTAGEのRiot.jsをv2からv3に上げるまでの軌跡を描いた感動のストーリー

yuuki79

February 02, 2017
Tweet

More Decks by yuuki79

Other Decks in Technology

Transcript

  1. ςϯϓϨʔτΤϥʔ͕ग़ΔΑ͏ʹͳͬͯͨ w ςϯϓϨʔτ಺ͰॳظԽ͞Εͯͳ͍஋ͱ͔ͰେྔʹΤϥʔ w <p>{ item.value }</p>ͰNPVOU࣌ʹJUFN͕ VOEFpOEͩͱμ ϝɻthis.item =

    {}ͱ͔΍ͬͯରԠ w ॳظԽ͸େࣄͳͷͰΤϥʔ͕ग़ΔΑ͏ʹͳͬͯخ͍͠վ ળ 3JPUͰ͸ɺλά಺ͷςϯϓϨʔτͷΤϥʔΛΩϟον͢ΔͨΊʹ͸ࣗ෼Ͱؔ਺Ληοτ͢Δ ඞཁ͕͋Γ·ͨ͠ɻ3JPUͰ͸ɺλά಺ͷશͯͷςϯϓϨʔτΤϥʔ͸DPOTPMFFSSPS͔Βग़ྗ ͞Ε·͢ɻ DPOTPMF"1*͕ར༻Մೳͳ৔߹
  2. w ద੾ʹมߋ͍͕ͯͨ͠ҧ͏ڍಈΛ͍ͯ͠Δύλʔϯ͕͋ͬͨɻ w 0CKFDU͡Όͳ͍͚Ͳ"SSBZͰೋॏʹϧʔϓͤͯ͞Δ࣌ͷڍಈ͕ͪΌΜͱ͢ΔΑ͏ʹͳͬͯͨ ΦϒδΣΫτϧʔϓͷจ๏มߋ ΦϒδΣΫτͷϧʔϓͷจ๏͕มΘΓ·͢ɻҎલ͸LFZ WBMVFJOPCKFDUͰ͕ͨ͠ɺ WBMVF LFZJOPCKFDUʹมߋ͞Ε·͢ɻ <div

    each=“value, key in Array”> <li each=“key2 in Array2”> <p>{ key2 }</p> // ←͜͜ʹkey͕དྷ͍ͯͨɻv2͸ͪΐͬͱม ( hoge, fuga ) </li> </div> Array2 = [ { hoge: { objKey: objValue } }, { fuga: { objKey: objValue } } ] // ͜Ε͕ͦΕͧΕ hoge, fuga ͷ object ͕ key2 ʹདྷΔΑ͏ʹͳͬͯ͠·ͬͨͷͰɺ͜͏΍ͬͯमਖ਼ͨ͠ <div each=“value, key in Array”> <li each=“value2, key2 in Array2”> // ←value2, key2 ͷΑ͏ʹ̎ͭҾ਺Λ༻ҙͨ͠ <p>{ key2 }</p> </li> </div>
  3. w ࠓ·Ͱ͸
 <button-tag each={buttons} onclick={ clickEvent }>
 ͬͯॻ͍ͯ΋ಈ͍͚ͯͨͲparent.clickEventͬͯ ॻ͔ͳ͍ͱಈ͔ͳ͔ͬͨΓɻ w

    Ͳ͔͜ͰZJFME࢖ͬͯΔλάʹZJFMEUBH\IPHF^ ZJFMEUBHͰ౉͚ͬͯͨͲɺ\QBSFOUIPHF^ͬͯॻ͔ ͳ͍ͱμϝͳײ͡ʹΏΒ͕͗ͳ͘ͳͬͨɻ FBDIͱZJFMEͰͷQBSFOU͕ద౰͡Όͳ͘ͳͬͨ
  4. w ओʹGPSNͷॲཧ͕յΕΔɻ w <form id=“formId”>ʹରͯ͠
 let formId = this.formId
 ͬͯऔΕͯͨ

    w <form ref=“formId”>ʹରͯ͠
 let formId = this.refs.formId
 ͰऔΔΑ͏ʹमਖ਼ OBNFͱJEʹΑΔ%0.ࢀরͷഇࢭ
  5. w W w FBDI಺ͰZJFME࢖ͬͯΔͱFBDIͰճͯ͠ΔJUFN͕དྷͳ͘ͳͬ ͨɻ w QBSFOUʹ͍Δ͔ͱࢥ͚ͬͨͲډͳ͍ɻ୳ͨ͠Β@QBSFOUʹ͸ ೖ͍ͬͯͨͷͰ@QBSFOUJUFNͬͯ΍ͬͨΒདྷͨ w FBDI\WBMVF

    JJOWBMVFT^ͬͯॻ͍ͨΒZJFMEʹ͸ @QBSFOUWBMVF @QBSFOUJͬͯॻ͔ͳ͍ͱདྷͳ͍ɻ w ԼهJTTVFͱಉ͡ݱ৅Ά͍ w IUUQTHJUIVCDPNSJPUSJPUJTTVFT ZJFME FBDIͰٽ͘
  6. w W w @QBSFOU͕ഇࢭɻ@@QBSFOUʹมߋɻ @@ͬͯ࢖͍͍ͬͯͷ͔ʜʁ w WͰ͸ZJFMEͰQBSFOU͕ͪΌΜͱݟΒΕΔ༷ʹͳͬͨͱࢥͬͯͨΒFBDIͰճͯ͠Δ࣌ͷZJFMEʹ͸ QBSFOUࢦఆͯ͠ॻ͘ͱಧ͔ͳ͍ɻɻ w ࣗλάͷFBDIʹؔͯ͠͸ZJFMEʹ͸QBSFOUແ͠Ͱσʔλ͕౉͍ͬͯΔΆ͍

    ZJFME FBDIͰٽ͘ <font> <span> <yield/> </span><br> </font> <font each="{testItems}" class="{label}"> "{parent.label}", </font> <font each="{testItems}" class="{label}"> "{label}", </font> ZJFME࢖ͬͨλάͱσʔλ σʔλ͕౉Βͳ͍ σʔλ͕౉ͬͪΌ͏ this.testItems = [ { label: 'Nyan' }, { label: 'Meow' }, { label: 'Meaou' } ];
  7. w ଎͍ʂʂ w ϥΠϑαΠΫϧ͕࠷దԽ͞ΕͨΓɺ৭ΜͳύϑΥʔϚϯεվળ͕ೖͬͨͷͰૉ੖Β͍͠ w FWFOUॲཧ͕ΊͬͪΌ଎͍ w PCTFSWBCMFͳॲཧΛ࿈ଧ͢ΔͱΨοπϦ஗͘ͳͬͯͨͷ͕ղফ ".&45"(&ͷΪϑτૹ৴ ౳

     w JG͕ͪΌΜͱJGʹͳͬͨͷͰ࢖͑Δײ͕૿ͨ͠ w VQEBUF NPVOUΠϕϯτͷڍಈ͕҆ఆ w ࢠλά͔ΒͷӨڹΛड͚ͳ͔ͬͨΓɺNPVOUલʹVQEBUF͕དྷͳ͘ͳͬͨΓɺΑΓ௚ײతʹ ࢖͑ΔɻύϑΥʔϚϯεʹ΋ྑͦ͞͏ w JGͰ։͍ͨΓดͨ͡Γͨ͠λάʹͪΌΜͱຖճNPVOU͕དྷΔΑ͏ʹͳͬͯ৺ʹӫཆɺ͜Ε ͧNPVOUͬͯײ͡ͷϥΠϑαΠΫϧվળʹ৺ΛଧͨΕͨ Wʹͯ͠خ͔ͬͨ͜͠ͱ