<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chaiwut Sittiboonta on Medium]]></title>
        <description><![CDATA[Stories by Chaiwut Sittiboonta on Medium]]></description>
        <link>https://medium.com/@chaiwut?source=rss-5a3525eecc99------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*UDutSqSbkFJ1MyneCjkHvw.png</url>
            <title>Stories by Chaiwut Sittiboonta on Medium</title>
            <link>https://medium.com/@chaiwut?source=rss-5a3525eecc99------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 22:20:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chaiwut/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Add the event to Google Calendar via Notion]]></title>
            <link>https://medium.com/@chaiwut/add-the-event-to-google-calendar-via-notion-d7088e5daa39?source=rss-5a3525eecc99------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7088e5daa39</guid>
            <category><![CDATA[notion]]></category>
            <category><![CDATA[zapier]]></category>
            <category><![CDATA[google-calendar]]></category>
            <dc:creator><![CDATA[Chaiwut Sittiboonta]]></dc:creator>
            <pubDate>Wed, 18 May 2022 09:10:12 GMT</pubDate>
            <atom:updated>2022-05-18T09:15:55.180Z</atom:updated>
            <content:encoded><![CDATA[<p>ใด้ใช้ Notion มาได้ระยะเวลาหนึ่ง รู้สึกชอบและทำอะไรได้หลาย ๆ อย่าง สามารถปรับรูปแบบได้ตามงาน หรือความต้องการของตัวเราเองด้วย แต่มีสิ่งหนึ่งที่ผู้ใช้งานหลายๆ คนต้องการแต่ยังไม่มีใน Notion ก็คือการ update กิจกรรมของเราเองไปที่ Google Calendar ผมเลยไปหาวิธีทำในอินเทอร์เน็ตมา มีหลายวิธีอยู่พอสมควร วันนี้ผมเลยเอาวิธีที่ผมใช้งานอยู่มาแบ่งปัน เผื่อมีใครอยากลองใช้ดูบ้างครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vi7yVSa9lH53dWbUU5jv4Q.png" /><figcaption>Notion and Google Calendar</figcaption></figure><h3>ทำยังไง?</h3><p>จริง ๆ แล้วการส่ง Request จาก Notion เพื่อไป update กิจกรรมใน Google Calendar โดยตรงยังทำได้แต่ผมใช้ตัวช่วยอย่าง Zapier เพื่อเชื่อมทั้งสองเข้าด้วยกัน โดยสามารถทำเป็น Two-way sync ยังได้เลยครับ คือการ update ฝั่งไหนก็ได้อีกฝั่งก็จะอัพเดทตามครับ โดยใครที่ยังไม่เคยใช้งานสามารถไปสมัครได้ฟรีเลยครับ ที่ <a href="https://zapier.com/">https://zapier.com/</a></p><h3>สร้าง Notion Table view databases</h3><p>ก่อนอื่นเลยผมสร้าง Table view databases ไว้หนึ่งตารางครับเพื่อเก็บกิจกรรมของเราไว้โดยฟิลด์ที่จำเป็นต้องมีเลยคือวันที่และเวลานะครับ ส่วนฟิลด์อื่นสามารถปรับได้ตามใจเลย ส่วนใครที่ไม่ทราบว่า Table view databases คืออะไรก็ลองตามไปดูได้ที่นี่ครับ <a href="https://www.notion.so/help/guides/table-view-databases">https://www.notion.so/help/guides/table-view-databases</a></p><h3>Connect Google Calendar + Notion</h3><p>เมื่อเรามี Zapier แล้ว จากนั้นเราก็สามารถเชื่อมกันได้แล้วครับ ทาง Zapier เข้า wizard ให้เราจัดการได้ง่ายมากเลย แล้วยังมีอีกหลาย Flow ให้เราเลือกลองเข้าไปดูที่ <a href="https://zapier.com/apps/google-calendar/integrations/notion">https://zapier.com/apps/google-calendar/integrations/notion</a> ครับ ส่วนที่ผมใช้อยู่จะเป็นตัวนี้ <a href="https://zapier.com/shared/53c26d2de14a62570ccf0d1ef0b29e667cd34164"><strong>Quick add events to Google Calendar when new items are added to Notion databases</strong></a> ตัวนี้ครับ <strong>โดยหากเราใช้เวอร์ชั่น Zapier เวอร์ชั่นฟรี trigger จะทำงานทุก 15 นาทีครับ</strong></p><p>จากนั้นให้เรากดเลือกที่ Try this Zap ครับ ทาง Zapier จะเริ่ม wizard เพื่อให้เราเชื่อมต่อกับ Notion และ Google ขั้นตอนแรกจะเป็นการเช่ือมต่อกับ Notion ก่อนครับ ให้เราเลือกว่าจะเชื่อมจากแอฟไหน ให้เราเลือก Notion ส่วน Event จะเลือกเป็น New Databest Item ครับ เสร็จแล้วกด Continue ได้เลยครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*Bqo3lVlcQOVrfNszMMvDdQ.png" /><figcaption>Choose app &amp; Event</figcaption></figure><p>เมื่อเราเข้าระบบ Notion เพื่อขอ Permission ได้แล้วก็กด Next เพื่อไปยังขั้นตอนต่อไปครับ ทาง Zapier จะทำการดึง database ที่อยู่ใน Account Notion ของเราออกมา ให้เราเลือกว่าเราจะใช้ databases ใน Notion อันไหน ในขั้นตอน Set up trigger ผมเลือก database ที่ชื่อ Appointment ของผม จากนั้นกด continue เพื่อให้ Zapier ได้ลองทดสอบว่าสามารถ trigger ได้ไหม</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*pZQmVnltDoPk0K-xXEkLQQ.png" /><figcaption>Set up Database trigger</figcaption></figure><p>หากไม่มีอะไรผิดพลาดทาง Zappier ก็จะดึงข้อมูลจากใน Notion มาให้เราดูครับ เราก็สามารถกด Continue ได้เลย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*CX896jGlE0nJqujQf4iceQ.png" /><figcaption>Test Trigger</figcaption></figure><p>ขั้นตอนต่อไปเป็นการตั้งค่า Google Calendar ครับ ใน Choose app &amp; Event เราจะเลือก Google Calendar และช่อง Event เราจะเลือกใช้งาน Create Detailed Event พอเลือกเสร็จแล้ว กด Continue เพื่อไปเข้าระบบของ Google และเลือกปฏิทินที่ต้องการเชื่อมต่อกับ Notion กันได้เลยครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*j3ZK8Nz168obCWPhOPthNA.png" /><figcaption>Choose app &amp; Event on Google</figcaption></figure><h3>Set up action</h3><p>ขั้นตอนนี้สำคัญครับ เราต้องทำการ map ระหว่าง Notion database item ซึ่ง Zapier จะแสดงตัวอย่างในแต่ละ Column ให้เรา <em>(Zapier เอามาตอนที่เราเชือมกับ Notion)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KNSluUxEv86cKqf7WQaKvg.png" /><figcaption>Appointment Table</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*eMzQ_3vH92zbONP9IdQCQw.png" /><figcaption>Set up action</figcaption></figure><p>จากภาพด้านบนจะเห็นว่า ผมเลือก calendar เป็น <strong>Birthday</strong> ใน summay ผมจะ map เจ้าคอลัมที่ชื่อว่า Title ใน Notion ที่เหลือเราก็เลือก Map ได้เต็มที่เลยครับ จะมีส่วนที่ควรระวังคือ <strong>Start Data &amp; Time </strong>กับ <strong>End Date &amp; Time</strong> จะต้องมีวันที่และเวลาด้วยครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*omV1veDUNbY6SaBvPNRREQ.png" /><figcaption>Start and End date</figcaption></figure><p>เมื่อเรา Map ทุกอย่างได้ถูกต้องเราสามารถกด Test Action ได้เลยครับ ทาง Zapier จะส่ง Notion data ไปสร้าง event ใน Google calendar ให้ครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*d6UBixbA0QvJHH7vxKD_HA.png" /><figcaption>Zapier Test action</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*oGZe9TL3XtnD1BM504gmxg.png" /><figcaption>Event in the calendar</figcaption></figure><p>จากนั้นกด Publish Zap เป็นอันเสร็จสิ้นครับ จากนี้หากมี item เพิ่มเข้ามาที่ตาราง Appointment ของผม ทาง Zapier ก็จะจัดการเอาไปสร้าง event ใน Google Calendar ตามที่เราตั้งค่าไว้ครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7088e5daa39" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Tenkeyless to 47 keys]]></title>
            <link>https://medium.com/@chaiwut/from-tenkeyless-to-47-keys-25c6c03d5e9f?source=rss-5a3525eecc99------2</link>
            <guid isPermaLink="false">https://medium.com/p/25c6c03d5e9f</guid>
            <category><![CDATA[mechanical-keyboards]]></category>
            <category><![CDATA[colemak]]></category>
            <category><![CDATA[keyboard]]></category>
            <category><![CDATA[ergodox]]></category>
            <dc:creator><![CDATA[Chaiwut Sittiboonta]]></dc:creator>
            <pubDate>Wed, 30 Oct 2019 06:04:31 GMT</pubDate>
            <atom:updated>2019-10-30T06:04:31.634Z</atom:updated>
            <content:encoded><![CDATA[<p>หลังจากใช้ Compact keyboard อยู่พักใหญ่ ในการทำงานจนคิดว่าทุกอย่างน่าจะลงตัวแล้วสำหรับคีย์บอร์ด แต่เปล่าเลย…</p><p>พยายามป้ายยาน้องที่ทำงานให้เสียเงินให้กับ Machanical Keyboard ให้มาเป็นครอบครัวเดียวกัน แต่หารู้ไหมว่าน้องเขาหงายการ์ดสะท้อนกลับ กลายเป็นป้ายยาให้กับตัวเองซะงั้นไป เข้าเรื่องกันเลยดีกว่า</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*8xtfOZcFbSVYYx0dJ_j46A.jpeg" /><figcaption><a href="https://imgur.com/gallery/OJ8aQik/comment/373301082">https://imgur.com/gallery/OJ8aQik/comment/373301082</a></figcaption></figure><p>ผมจะเป็นคนที่ชอบความมินิมอล ผมมีคีบอร์ดเจ้าหนึ่งซึ่งผมชอบเอามากๆ และเคยเกือบจะซื้อมาแล้วครั้งหนึ่ง แต่ด้วยราคาที่ไม่ค่อยเป็นมิตรกับกระเป๋าเงินสักเท่าไหร่จึงได้แต่สบตามองแบบจำใจ เจ้าคีบอร์ดตัวนั้นมีชื่อว่า <a href="https://ergodox-ez.com/"><strong>ErgoDox EZ</strong></a><strong> </strong>ซึ่งราคามันก็ไม่เบาทีเดียว เริ่มต้นที่ $299 เท่านั้นเอง แม่เจ้า มาดูหน้าตากันหน่อย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BBqwaG86fQy2OhOOsv2fug.jpeg" /><figcaption><a href="https://ergodox-ez.com/">https://ergodox-ez.com/</a></figcaption></figure><p>กลับไปเรื่องป้ายยา ในขณะที่ผมกำลังเข้าเว็บ <a href="https://ergodox-ez.com/">https://ergodox-ez.com/</a> เพื่อจะป้ายยาให้น้องดันไปเจอคีย์บอร์ดอีกตัวหนึ่งของเจ้าเดียวกัน ผมไม่รู้ด้วยซ้ำว่าออกมาใหม่ ทำผมซะงักไป 10 วินาที ก้มลงมองคีย์บอร์ดตัวเองซึ่งผมใช้ <a href="https://www.coolermaster.com/catalog/peripheral/keyboards/masterkeys-pro-s/">Cooler Master MasterKeys Pro S RGB</a> ในใจตอนนั้นคือไม่น่ารอด และก็ไม่รอดจริงๆ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*6HpMGHvRwuyYJdLPxcfWQQ.png" /><figcaption><a href="https://ergodox-ez.com/pages/planck">https://github.com/qmk/qmk_firmware/tree/master/keyboards/planck/ez</a></figcaption></figure><p><a href="https://ergodox-ez.com/pages/planck">Planck EZ</a> เป็นคีย์บอร์ดขนาด 47 คีย์เท่าเอง มันเล็กพอดีกับกระเป๋าสามารถพกพาไปไหนมาไหนได้ง่าย ผมเห็นครั้งแรกก็คิดว่ามันใช่เลย จริงๆ ทีแรกก็คิดอยู่ว่ามันจะเล็กไปหรือเปล่านะ แต่พอได้ของมาจริง ไม่ก็ไม่ได้เล็กมากมายนะ พอดีมือเลยทีเดียว เพื่อนๆ ที่เห็น ต่างบอกว่าจะไหวเหรอเล็กเกินนนนน</p><p>ผมใช้เวลาปรับตัวกับมันอยู่ประมาณสามวันสำหรับภาษาอังกฤษ ใช้ทำงานเลย แรกๆ มีปัญหากับปุ่ม Space Bar, Enter, Tab, ESC, Arrow กดไม่โดนบ้าง กดผิดบ้าง โดยเฉพาะ Arrow ว่ากันไป ก็ปรับตัวกันไป</p><p>พอเริ่มทำงานได้ ก็เริ่มรู้ว่าเราควรที่จะ Customize มันแล้วล่ะซึ่งทาง ZSA Technology Labs เขาก็มี Tools และ Application มาให้ด้วยอยู่แล้ว ทำให้การ Customize และการ Flash ไม่ใช่เรื่องยากอีกต่อไป</p><h3>Customising Layout</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*vNbyfO2gDcgl8aaZQR97Jg.png" /><figcaption><a href="https://ergodox-ez.com/pages/oryx-planck">https://ergodox-ez.com/pages/oryx-planck</a></figcaption></figure><p><strong>ORYX</strong> เป็น Configuration Tools สำหรับสร้าง Layout Keyboard ซึ่งเราสามารถกำหนด และจัดการปุ่มต่างได้ตามที่เราต้องการ อีกทั้งเราสามารถ Clone Layout ของคนอื่นที่แชร์ไว้มาใช้ได้อีกด้วยนะ</p><p>ส่วนตัวผมเองใช้งาน <a href="https://medium.com/@chaiwut/%E0%B8%88%E0%B8%B2%E0%B8%81-qwerty-%E0%B8%AA%E0%B8%B9%E0%B9%88-colemak-d1303c109424"><strong>Colemak</strong></a> เป็น Layout หลัก การ Customize ของผมจะออกมาแบบนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3NiEaPxhyAE49CpfXaDi0g.png" /></figure><p>หากสังเกตด้านบนจะมี Tab อยู่ ซึ่งเราสามารถเปลี่ยน Layout ได้ตลอดเวลา โดยการกดปุ่ม Lower, Raise, Hyper หรือ Key อื่นๆ ที่เราตั้งเอาไว้ ลองดูตัวอย่าง Layout ที่ผมใช้งานอยู่</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WrhhC9USr4HQfccyXe04oA.png" /><figcaption>Lower</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e2QmdvnosrLmH8xZmedgpQ.png" /><figcaption>Raise</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0jUCqyzcnCm4LHPLWtKFaQ.png" /><figcaption>Adjust (Lower + Raise)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GTGbn4t_sI6mFJvged_7ag.png" /><figcaption>Special Layout (Holding Hyper Key)</figcaption></figure><p>พอเราตั้งค่า Layout เสร็จแล้ว เราสามารถ Compile แล้ว Download Layout เพื่อ Flash ลง Keyboard เราได้เลย สำหรับใครที่อยากเอา Layout ผมไปลองใช้ก็เข้าไปดูได้นะครับ <a href="https://configure.ergodox-ez.com/planck-ez/layouts/9DbEK/latest/0">https://configure.ergodox-ez.com/planck-ez/layouts/9DbEK/latest/0</a></p><p>หากไม่ทราบว่า ปุ่ม Lover, Raise, Hyper คืออะไรลองดูที่รูปด้านล่างครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wOcbwOgUireOXDxA70EipA.png" /><figcaption><a href="https://ergodox-ez.com/pages/planck">https://ergodox-ez.com/pages/planck</a></figcaption></figure><p>หรือสามารถเข้าไปดูเพิ่มเติมได้ที่ <a href="https://ergodox-ez.com/pages/planck">https://ergodox-ez.com/pages/planck</a> ครับ</p><h3>Flashing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*YjyX9CytIo_XPXUxrfCufQ.png" /><figcaption><a href="https://ergodox-ez.com/pages/wally-planck">https://ergodox-ez.com/pages/wally-planck</a></figcaption></figure><p>หลังจากเรา Customize Layout ได้ดั่งใจแล้ว ขั้นตอนต่อไปก็คือการ Flash ซึ่งทาง Ergodox เขาก็มี Application มาช่วยจัดการเรื่องนี้โดยเฉพาะ นั่นก็คือ <a href="https://ergodox-ez.com/pages/wally-planck"><strong>Wally</strong></a> ซึ่งสามารถเข้าไป Download ได้เลย</p><p>วิธีการก็ง่ายแสนง่าย แค่เปิด Application ​ขึ้นมา แล้วเลือกไฟล์ Layout ที่เราได้ Complie ไว้ก่อนหน้า ทำตามขั้นที่ Application บอกได้เลยไม่ยาก</p><h3>ใช้งานจริง</h3><p>ถึงแม้จะเป็น Keyboard ที่เล็กมาก แต่การใช้งานสำหรับผมแล้วถือว่าดีมากเลย</p><ul><li>ไม่ต้องยกมือเยอะในกรณีที่ต้องการพิมพ์ตัวอักษรที่อยู่แถบบนของ keyboard แบบทั่วไป เช่น ตัวเลข หรือเครื่องหมายต่างๆ</li><li>สลับ Layout แสนง่าย</li><li>พิมพ์เร็วขึ้น โดยเฉพาะ Layous Colemak</li><li>ภาษาไทย ตอนแรกเหมือนฝันร้าย พอเริ่มใช้ไปสักพักเริ่มดี และชอบ</li><li>Customize ได้ทุกอย่าง</li><li>เปลี่ยน Switch ได้ โดยไม่ต้องกลัวหมดประกัน</li><li>มีโหมดใช้งานแทนเมาส์</li></ul><p>มีลูกเล่นอีกหลายอย่าง ไว้ผมลองแล้วจะมาเล่าให้ฟังนะครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25c6c03d5e9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[จาก QWERTY สู่ Colemak]]></title>
            <link>https://medium.com/@chaiwut/%E0%B8%88%E0%B8%B2%E0%B8%81-qwerty-%E0%B8%AA%E0%B8%B9%E0%B9%88-colemak-d1303c109424?source=rss-5a3525eecc99------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1303c109424</guid>
            <category><![CDATA[keyboard]]></category>
            <category><![CDATA[colemak]]></category>
            <category><![CDATA[qwerty]]></category>
            <dc:creator><![CDATA[Chaiwut Sittiboonta]]></dc:creator>
            <pubDate>Tue, 15 Jan 2019 10:47:55 GMT</pubDate>
            <atom:updated>2019-01-15T12:17:00.077Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*88risGOBq1SJ2RNaiwwdYw.jpeg" /></figure><p>ครึ่งชีวิตที่ใช้งาน QWERTY หลายครั้งที่มีความคิดว่า อยากจะเปลี่ยนเลย์เอาท์ของคีย์บอร์ดดูบ้าง ในการทำงานแต่ละครั้ง (เฉพาะภาษาอังกฤษ) รู้สึกได้ว่าระยะห่างในระหว่างแต่ละตัวอักษรไม่ค่อยจะเข้ากับการวางมือสักเท่าไหร่ เลยลองศึกษาดูว่านอกจาก QWERTY แล้ว ยังมีเลย์เอาท์แบบไหนอีก ซึ่งมีหลายเลย์เอาท์มาก ในที่สุดก็ตัดสินใจลองอยู่ 3 เลย์เอาท์คือ</p><ul><li><a href="https://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard">Dvorak</a></li><li><a href="https://colemak.com/">Colemak</a></li><li><a href="https://workmanlayout.org/">Workman</a></li></ul><p>ทั้งสามเลย์เอาท์แล้ว มีความต่างกันในการวางตำแหน่งคีย์อย่างชัดเจน ทีนี้ก็ต้องมาดูอีกว่า แบบไหนเหมาะกับการใช้งานในชีวิตประจำวัน และการทำงานของเรามากที่สุด และที่สำคัญเราใช้ QWERTY มาตั้งแต่พิมพ์ดีด การที่จะเปลี่ยนเราจะใช้เวลาในการปรับตัวนานแค่ไหนด้วย</p><p><strong>แบบไหนที่ต้องการ?</strong></p><ul><li>ข้อแรกที่ต้องการคือ <strong>ระยะห่างระหว่างคีย์ที่ต้องใช้บ่อยๆ<em> </em></strong>เนื่องจากการที่ต้องเขียนโค๊ดทั้งวันยอมรับเมื่อยนิ้วมือเลย และถึงขั้นนิ้วล็อคมาแล้ว จึงคิดว่าควรที่จะรวมคีย์ที่ใช้บ่อยๆ มาอยู่ใกล้ๆ กัน</li><li>ข้อที่สอง<strong> บางตำแหน่งของ QWERTY ดีอยู่แล้ว</strong> ไม่อยากเปลี่ยนเพราะเราใช้ต้องตัวอักขระพิเศษในการเขียนโค๊ดซึ่งบางตำแหน่งมันเหมาะสมกับการวางนิ้วอยู่แล้วจึงอยากให้อยู่ที่เดิม</li></ul><p>ด้วยเหตุผลสองข้อด้านบน พอสรุปความต้องการของตัวเองได้คร่าวๆ ยังหวง QWERTY เลยอยากเปลี่ยนแค่บางตำแหน่ง พอลองทดสอบกับเว็บ <a href="https://thetypingcat.com/">TypingCat</a> เพื่อหาแบบที่ถูกใจ เข้ากับการใช้งาน และไม่ลำบากที่จะเปลี่ยนคือ <strong>Colemak</strong></p><p><strong>QWERTY</strong></p><p>ก่อนอื่นเรามาดู QWERTY กันก่อน เริ่มจากชื่อของมันก่อนเลย ก็มาจากคีย์แถวแรกที่มีตัวอักษร Q, W, E, R, T, Y อยู่เรียงกันนั่นเอง โดยมันถูกสร้างมาพร้อมๆ กับเครื่องพิมพ์ดีดเมื่อปี 1873</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*hN9_CJtLG61EwqDOQvywsA.jpeg" /><figcaption>ภาพจาก <a href="https://board.postjung.com/1046933">https://board.postjung.com/1046933</a></figcaption></figure><p>และมันถูกออกแบบมาให้ตัวอักษรที่ใช้ร่วมกันบ่อยๆ (commonest letters) อยู่คนละด้านกัน เพื่อไม่ให้ก้านพิมพ์ติดกันเวลาพิมพ์ ตั้งแต่นั้นมาเราก็ใช้ QWERTY กันมาเรื่อยๆ ไม่ใช่ว่าไม่มีเลย์เอาท์อื่น หากเพียงแต่ว่าไม่ค่อยได้รับความนิยม เพราะคนยุคก่อนโตมากับพิมพ์ดีด จะเห็นว่าปันจุบันเด็กรุ่นใหม่ที่โตมากับสมาร์ทโฟน และเครื่องคอมพิวเตอร์ ไม่ได้ใช้ หรือเริ่มต้นด้วย QWERTY แล้ว</p><p><strong>Colemak</strong></p><p>ถูกคิดขึ้นมาโดย Shai Coleman เมื่อปี 2006 ที่ผ่านมานี่เองโดยมาจากแนวคิดที่ต้องการรวมตัวอักษรที่ใช้งานบ่อยที่สุดมาไว้ในตำแหน่งของนิ้วที่สามารถเคลื่อนไหวได้เร็ว เช่น นิ้วชี้ นิ้วกลาง เป็นต้น หรือตำแหน่งตรงกลางของคีย์บอร์ดนั่นเอง</p><p>อีกข้อที่ทำให้ผมตกลงปลงใจคือมีเพียงแค่ 13 คีย์เท่านั้นที่เปลี่ยนไปจากเดิม ทำให้การเปลี่ยนมาใช้ Colemak ง่ายสำหรับผม ซึ่งแถวบนที่เป็นตัวเลขจะเห็นว่าไม่เปลี่ยนเลย รวมไปถึงอักขระพิเศษต่างๆ ยังอยู่ที่เดิมอีกด้วย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*hJF-jvFhnQX7LfluLrvGFQ.png" /><figcaption><a href="https://colemak.com/">https://colemak.com/</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o3c25XZ-Th_jy9FwyCiv2A.png" /><figcaption>QWERTY : <a href="https://en.wikipedia.org/wiki/QWERTY">https://en.wikipedia.org/wiki/QWERTY</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*oVRu4PFJHSVXmGD5wBQJuw.png" /><figcaption><a href="http://mkweb.bcgsc.ca/carpalx/?colemak">http://mkweb.bcgsc.ca/carpalx/?colemak</a></figcaption></figure><p><strong>ข้อแตกต่าง</strong></p><p>หลังจากหาข้อมูลมาหลายๆ เว็บไซต์เพื่อเปรียบเทียบตำแหน่งการกด รวมไปถึงคีย์ที่เราใช้บ่อยที่สุดในเว็บไซต์ <a href="https://www.patrick-wied.at/projects/heatmap-keyboard/">https://www.patrick-wied.at/projects/heatmap-keyboard/</a> เราสามารถดู Heatmap การใช้คีย์ โดยลองใช้คำว่า</p><blockquote>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</blockquote><p>และนี่คือ Heatmap ของ QWERTY และ Colemak</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*AEFZ1QUpcgskk0GxwHE6JA.png" /><figcaption>QWERTY</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*twENOqkeHrH3mh7l_kCYRQ.png" /><figcaption>Colemak</figcaption></figure><p>หากสังเกตุจาก Heatmap จะเห็นได้ว่าคีย์ที่ใช้มากที่สุดจะเป็น T และ E ซึ่งคีย์ที่มีการกดมากที่สุดจะอยู่ช่วงแถวตรงกลางคีย์บอร์ด Colemak จัดคีย์ได้ดีกว่าเพราะไม่ต้องยกนิ้วเปลี่ยนคีย์มากเหมือน QWERTY ซึ่งต้องเลื่อนนิ้วขึ้นไปกดคีย์แถวบนบ่อยพอสมควร</p><p>โดยส่วนตัวคิดว่าการเปลี่ยนมาใช้ Colemak ไม่ได้ใช้เวลานานอย่างที่คิด พิมพ์ได้คล่องขึ้นกว่าเดิมด้วยซ้ำ รวมแล้วในเวลาในการทดสอบอยู่ 1 อาทิตย์และตอนนี้ก็เปลี่ยนมาใช้ Colemak แบบถาวรเรียบร้อยแล้ว</p><p><strong>การติดตั้ง</strong></p><p>สำหรับ Mac user นั้น ไม่ต้องติดตั้งหรือลงซอฟท์แวร์ใดๆ เลยสามารถเข้าไปตั้งค่าที่คีย์บอร์ดได้เลยครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*O1D_8Zfg7d4icm3g2wQIUQ.png" /></figure><p><strong>Referents:<br></strong><a href="http://www.ideafinder.com/history/inventions/qwerty.htm">http://www.ideafinder.com/history/inventions/qwerty.htm</a><br><a href="https://en.wikipedia.org/wiki/QWERTY">https://en.wikipedia.org/wiki/QWERTY</a><br><a href="https://colemak.com/">https://colemak.com/</a><br><a href="https://workmanlayout.org/">https://workmanlayout.org/</a><br><a href="https://en.wikipedia.org/wiki/Colemak">https://en.wikipedia.org/wiki/Colemak</a><br><a href="http://mkweb.bcgsc.ca/carpalx/?colemak">http://mkweb.bcgsc.ca/carpalx/?colemak</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1303c109424" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular CLI 6.0.2 with Universal]]></title>
            <link>https://medium.com/@chaiwut/angular-cli-with-universal-769267b536a4?source=rss-5a3525eecc99------2</link>
            <guid isPermaLink="false">https://medium.com/p/769267b536a4</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[angular-universal]]></category>
            <dc:creator><![CDATA[Chaiwut Sittiboonta]]></dc:creator>
            <pubDate>Wed, 02 May 2018 06:16:46 GMT</pubDate>
            <atom:updated>2018-05-17T08:43:53.782Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*8klZiTlxZQdUyxbYp-vXMA.png" /></figure><p>ความสามารถของ search engine รวมไปถึง Social media ในปัจจุบันไม่ได้แสดงเพียงแค่ลิ้งค์ แต่ยังดึงเอารายละเอียด รวมไปถึงรูปภาพแสดงออกมาให้ผู้ใช้งานเห็นก่อนตัดสินใจเข้าไปยังเว็บไซต์</p><p>Angular เป็น Single Page Application (<strong>SPA</strong>) framework ที่ render ในบราวเซอร์ หรือที่เราเรียกว่า<strong> client-side rendering</strong> ทำให้ search engine และ social media ไปดึงข้อมูล HTML ที่ยังไม่ได้ผ่านการ render ออกมาแสดง</p><p>Angular Universal จะทำหน้าที่เป็น server-side renderer เพื่อให้ search engine และ social media ได้ดึงเอา HTML ที่ถูก render ไว้ก่อนแล้วไปใช้งาน เพื่อการแสดงผลที่ถูกต้อง</p><p>เริ่มจากการติดตั้ง Angular CLI ลงในเครื่อง</p><pre>npm install -g @angular/cli@latest</pre><p>สร้างโปรเจคใหม่พร้อมใช้งาน sass ในโปรดเจคด้วย <em>ดูเพิ่มเติม : </em><a href="https://stackoverflow.com/a/39816365/2045817"><em>https://stackoverflow.com/a/39816365/2045817</em></a></p><pre>ng new --style=scss demo-universal<br>cd demo-universal</pre><p>จากนั้น install ts-loader angular/platform-server และ @nguniversal/module-map-ngfactory-loader</p><pre>npm install --save @angular/platform-server @nguniversal/module-map-ngfactory-loader ts-loader</pre><p>แก้ไขไฟล์ app.mudule.tsโดยเพิ่ม withServerTransition() เพื่อให้แอพของเราทำงานร่วมกับ Universal</p><pre>@NgModule({<br>  declarations: [AppComponent],<br>  imports: [<br>    BrowserModule.withServerTransition({appId: &#39;demo-universal&#39;}),<br>  ],<br>  providers: [],<br>  bootstrap: [AppComponent]<br>})</pre><p>ขั้นตอนต่อไปสร้างไฟล์ module เพื่อเรียกใช้บนฝั่ง server ใน src/app/app.server.module.ts เพื่อจะเรียกใช้ AppModule ผ่านทาง ServerMudule</p><pre>import {NgModule} from &#39;@angular/core&#39;;<br>import {ServerModule} from &#39;@angular/platform-server&#39;;<br>import {ModuleMapLoaderModule} from &#39;@nguniversal/module-map-ngfactory-loader&#39;;<br><br>import {AppModule} from &#39;./app.module&#39;;<br>import {AppComponent} from &#39;./app.component&#39;;<br><br>@NgModule({<br>  imports: [<br>    AppModule,<br>    ServerModule,<br>    ModuleMapLoaderModule<br>  ],<br>  bootstrap: [AppComponent],<br>})<br>export class AppServerModule {}</pre><p>ต่อไปสร้างไฟล์สำหรับ Universal bundle เอาไว้ export AppServerModule ใช้ชื่อว่า src/main.server.ts</p><pre>export { AppServerModule } from &#39;./app/app.server.module&#39;;</pre><p>เสร็จแล้วให้เรากลับไปดูที่ไฟล์ tsconfig.app.json คัดลอกโค๊ดทั้งหมด แล้วสร้างไฟล์ tsconfid.server.json วางโค๊ดที่คัดลอกมาจาก tsconfig.app.json ให้เราเปลี่ยน module format จาก es2015 เป็น commonjs</p><pre>{<br>  &quot;extends&quot;: &quot;../tsconfig.json&quot;,<br>  &quot;compilerOptions&quot;: {<br>    &quot;outDir&quot;: &quot;../out-tsc/app&quot;,<br>    &quot;baseUrl&quot;: &quot;./&quot;,<br>    &quot;module&quot;: &quot;commonjs&quot;,<br>    &quot;types&quot;: []<br>  },<br>  &quot;exclude&quot;: [<br>    &quot;test.ts&quot;,<br>    &quot;**/*.spec.ts&quot;<br>  ]<br>}</pre><p>เพิ่ม extra property เพื่อบอกให้ compile ไฟล์ app.server.module สำหรับรายละเอียดเพิ่มเติมสามารถอ่านได้ที่ <a href="https://github.com/UltimateAngular/aot-loader/wiki/tsconfig.json">https://github.com/UltimateAngular/aot-loader/wiki/tsconfig.json</a></p><pre>{<br>  &quot;extends&quot;: &quot;../tsconfig.json&quot;,<br>  &quot;compilerOptions&quot;: {<br>    &quot;outDir&quot;: &quot;../out-tsc/app&quot;,<br>    &quot;baseUrl&quot;: &quot;./&quot;,<br>    &quot;module&quot;: &quot;commonjs&quot;,<br>    &quot;types&quot;: []<br>  },<br>  &quot;exclude&quot;: [<br>    &quot;test.ts&quot;,<br>    &quot;**/*.spec.ts&quot;<br>  ],<br>  &quot;angularCompilerOptions&quot;: {<br>    &quot;entryModule&quot;: &quot;app/app.server.module#AppServerModule&quot;<br>  }<br>}</pre><p>กลับไปที่ไฟล์ angular.json ใน property ที่ชื่อว่า architect เราจะเพิ่ม property ใหม่เข้าไป เพื่อกำหนดค่าการ build สำหรับ server</p><pre>&quot;architect&quot;: {<br>  ...<br>  &quot;server&quot;: {<br>    &quot;builder&quot;: &quot;@angular-devkit/build-angular:server&quot;,<br>    &quot;options&quot;: {<br>      &quot;outputPath&quot;: &quot;dist/server&quot;,<br>      &quot;main&quot;: &quot;src/main.server.ts&quot;,<br>      &quot;tsConfig&quot;: &quot;src/tsconfig.server.json&quot;<br>    }<br>  }<br>}</pre><p>จากนั้นให้เราลอง build project ของเราได้เลยครับ</p><pre>$ ng run demo-universal:server</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hmpBpny-B0C2lTftrXclPQ.png" /></figure><h3>Setting up an Express Server</h3><p>เราสร้างแอพ ตั้งค่าต่างๆ รวมไปถึง build ทุกอย่างผ่านได้แล้ว ขั้นตอนสุดท้ายเราจะ Run ได้ยังไง? เราจะใช้ <a href="https://expressjs.com/">Express.js</a> สำหรับ run Universal bundle ของเรา</p><p>สร้างไฟล์ server.ts ไว้ใน root ของแอพ</p><pre>import &#39;zone.js/dist/zone-node&#39;;<br>import &#39;reflect-metadata&#39;;<br>import {enableProdMode} from &#39;@angular/core&#39;;<br>// Express Engine<br>import {ngExpressEngine} from &#39;@nguniversal/express-engine&#39;;<br>// Import module map for lazy loading<br>import {provideModuleMap} from &#39;@nguniversal/module-map-ngfactory-loader&#39;;<br><br>import * as express from &#39;express&#39;;<br>import {join} from &#39;path&#39;;<br><br>// Faster server renders w/ Prod mode (dev mode never needed)<br>enableProdMode();<br><br>// Express server<br>const app = express();<br><br>const PORT = process.env.PORT || 4000;<br>const DIST_FOLDER = join(process.cwd(), &#39;dist&#39;);<br><br>// * NOTE :: leave this as require() since this file is built Dynamically from webpack<br>const {AppServerModuleNgFactory, LAZY_MODULE_MAP} = require(&#39;./dist/server/main&#39;);<br><br>// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)<br>app.engine(&#39;html&#39;, ngExpressEngine({<br>  bootstrap: AppServerModuleNgFactory,<br>  providers: [<br>    provideModuleMap(LAZY_MODULE_MAP)<br>  ]<br>}));<br><br>app.set(&#39;view engine&#39;, &#39;html&#39;);<br>app.set(&#39;views&#39;, join(DIST_FOLDER, &#39;browser&#39;));<br><br>// Example Express Rest API endpoints<br>// app.get(&#39;/api/**&#39;, (req, res) =&gt; { });<br><br>// Server static files from /browser<br>app.get(&#39;*.*&#39;, express.static(join(DIST_FOLDER, &#39;browser&#39;), {<br>  maxAge: &#39;1y&#39;<br>}));<br><br>// All regular routes use the Universal engine<br>app.get(&#39;*&#39;, (req, res) =&gt; {<br>  res.render(&#39;index&#39;, { req });<br>});<br><br>// Start up the Node server<br>app.listen(PORT, () =&gt; {<br>  console.log(`Node Express server listening on http://localhost:${PORT}`);<br>});</pre><p>ถึงตรงนี้เราได้ตั้งค่าสำหรับใช้ Node Expreess ไว้แล้ว ขั้นตอนต่อไป เป็นการตั้งค่า Webpack เพื่อบอกให้ Webpack ใช้ไฟล์ server.ts สำหรับ serve แอพของเรา ให้สร้างไฟล์ชื่อ webpack.server.config.js ใน root ของแอพ</p><pre>// Work around for https://github.com/angular/angular-cli/issues/7200<br><br>const path = require(&#39;path&#39;);<br>const webpack = require(&#39;webpack&#39;);<br><br>module.exports = {<br>  mode: &#39;none&#39;,<br>  entry: {<br>    // This is our Express server for Dynamic universal<br>    server: &#39;./server.ts&#39;,<br>  },<br>  target: &#39;node&#39;,<br>  resolve: { extensions: [&#39;.ts&#39;, &#39;.js&#39;] },<br>  // Make sure we include all node_modules etc<br>  externals: [/node_modules/],<br>  output: {<br>    // Puts the output at the root of the dist folder<br>    path: path.join(__dirname, &#39;dist&#39;),<br>    filename: &#39;[name].js&#39;<br>  },<br>  module: {<br>    rules: [<br>      { test: /\.ts$/, loader: &#39;ts-loader&#39; }<br>    ]<br>  },<br>  plugins: [<br>    new webpack.ContextReplacementPlugin(<br>      // fixes WARNING Critical dependency: the request of a dependency is an expression<br>      /(.+)?angular(\\|\/)core(.+)?/,<br>      path.join(__dirname, &#39;src&#39;), // location of your src<br>      {} // a map of your routes<br>    ),<br>    new webpack.ContextReplacementPlugin(<br>      // fixes WARNING Critical dependency: the request of a dependency is an expression<br>      /(.+)?express(\\|\/)(.+)?/,<br>      path.join(__dirname, &#39;src&#39;),<br>      {}<br>    )<br>  ]<br>}</pre><p>กลับไปที่ไฟล์ package.json ใน property scripts เพิ่มค่าเข้าไป</p><pre>&quot;scripts&quot;: {<br>  &quot;build:universal&quot;: &quot;npm run build:client-and-server-bundles &amp;&amp; npm run webpack:server&quot;,<br>  &quot;serve:universal&quot;: &quot;node dist/server.js&quot;,<br>  &quot;build:client-and-server-bundles&quot;: &quot;ng build --prod &amp;&amp; ng run demo-universal:server&quot;,<br>  &quot;webpack:server&quot;: &quot;webpack --config webpack.server.config.js --progress --colors&quot;<br>}</pre><p>จากนั้นใช้คำสั่ง</p><pre>$ npm run build:universal &amp;&amp; npm run serve:universal</pre><p>Perfect!</p><h3>หมายเหตุ:</h3><p>ขั้นตอนการใช้ Express Server นั้นเป็นการใช้เพื่อประกอบบทความ และใช้เป็นตัวอย่าง ควรจะตั้งค่าการเข้าถึง และความปลอดภัยหากนำไปใช้กับโปรเจคจริงๆ</p><p>จากการใช้งานจริงอาจจะมองหา framework เช่น PM2 (<a href="http://pm2.keymetrics.io/">http://pm2.keymetrics.io/</a>) เป็นต้น</p><h3>ช่วยเหลือ</h3><p>หากเราใช้ Algular CLI ที่มาพร้อมกับ Webpack 4 อาจจะเกิดปัญหา build ไม่ผ่าน ให้เปลี่ยน tsloader กลับไปเป็นเวอร์ชั่น 4.2.0</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=769267b536a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ionic 2–3 Nav Guards]]></title>
            <link>https://medium.com/@chaiwut/ionic-2-3-nav-guards-da6c39e72d9a?source=rss-5a3525eecc99------2</link>
            <guid isPermaLink="false">https://medium.com/p/da6c39e72d9a</guid>
            <category><![CDATA[ionic2]]></category>
            <category><![CDATA[angular2]]></category>
            <category><![CDATA[ionic3]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[angular-4]]></category>
            <dc:creator><![CDATA[Chaiwut Sittiboonta]]></dc:creator>
            <pubDate>Thu, 15 Jun 2017 03:51:24 GMT</pubDate>
            <atom:updated>2018-04-20T09:51:52.863Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d_w0M8RoJdXy4l84fsePhg.jpeg" /></figure><p>หากใครที่เขียน Angular 2 ~ 4 คงรู้จัก และคุ้นเคยกับ Routing Guards กันอยู่แล้ว พอหันกลับมาเขียน Ionic 2–3 กันบ้างซึ่งเราไม่ได้ใช้ Routes แต่เราใช้ <strong>NavController</strong> สำหรับการ Push หรือ Pop หน้าต่างๆ ภายใน Ioninc App ทาง Ionic 2–3 ก็มี Feature นี้ให้เหมือนกันนะครับ ชื่อว่า <strong>Nav Guards</strong></p><p>หลักการเดียวกันกับ Routing Guards ครับ Ionic 2–3 มีเมธอด <strong>ionViewCanEnter</strong><em> </em>และ <strong>ionViewCanLeave</strong><em> </em>เพื่อให้เราได้ควบการการเปลี่ยนหน้าต่างๆ ในแอพของเรา</p><blockquote><strong>ionViewCanEnter: boolean/Promise&lt;void&gt;:</strong> Runs before the view can enter. This can be used as a sort of “guard” in authenticated views where you need to check permissions before the view can enter</blockquote><blockquote><strong>ionViewCanLeave: boolean/Promise&lt;void&gt;:</strong> Runs before the view can leave. This can be used as a sort of “guard” in authenticated views where you need to check permissions before the view can leave</blockquote><p><strong>ionViewCanEnter </strong>จะถูกเรียกก่อน เพื่อให้เราได้กระทำการใดๆ ก่อนตัดสินใจว่าจะเข้าสู่เพจนี้หรือไม่</p><p><strong>ionViewCanLeave </strong>จะถูกเรียกเมื่อจะออกจากเพจนั้นๆ ก่อนที่จะไปยังเพจอื่นๆ</p><pre><strong>export</strong> <strong>class</strong> MyClass { <br>  <strong>constructor </strong>(public navCtrl: NavController) {}</pre><pre>  //When trying to leave the page will call <br>  //ionViewCanLeave()<br>  pushPage() {<br>    <strong>this</strong>.navCtrl.push(DetailPage)<br>         .catch(()=&gt; console.log(‘Something cache!’))<br>  }</pre><pre>  isValid() {<br>    return (validValue);<br>  }</pre><pre>  //Make a decision to stay or leave.<br>  ionViewCanLeave(): boolean { <br>    <strong>return </strong>this.isValid();<br>  }<br>}</pre><p>จากตัวอย่างข้างบนเราจะเห็นว่าก่อนที่เราจะ <em>push(DetailPage)</em> หรือออกจากเพจนี้ไป DetailPage, <em>ionViewCanLeave()</em> จะถูกเรียกใช้งาน isValid() เป็น condition ที่เราใช้ตรวจสอบก่อนตัดสินใจออกจากหน้านี้ หากค่าที่ได้ False, <em>.catch()</em> จะทำงาน</p><p>เช่นเดียวกับ <strong>ionViewCanEnter </strong>เพียงตรวจสอบว่าก่อนที่จะเข้าเพจนี้ จรงตาม condition ที่เราตั้งไว้หรือเปล่า</p><pre><strong>export</strong> <strong>class</strong> DetailPage() {   <br>  <strong>constructor</strong>(public navCtrl: NavController) {}</pre><pre>  isValid() {<br>    return (validValue);<br>  }</pre><pre>  ionViewCanEnter(): boolean {    <br><strong>    return </strong>this.isValid();<br>  } <br>}</pre><p>ทั้งหมดคือการทำงานของ <strong>Nav Guards </strong>โดยคร่าวๆ ครับลองเอาไปใช้กันดู หรือลองอ่านดูใน <a href="https://ionicframework.com/docs/api/navigation/NavController/#nav-guards">Doc ของ ionic 2–3</a> ก็ได้ครับ</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da6c39e72d9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>