Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Vugu: Go+WebAssemblyでつくる Omikuji-Go
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Misato Kawano
July 20, 2024
0
38
Vugu: Go+WebAssemblyでつくる Omikuji-Go
Misato Kawano
July 20, 2024
Tweet
Share
More Decks by Misato Kawano
See All by Misato Kawano
Gopherto
mikkegt
0
15
Featured
See All Featured
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
350
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
280
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
110
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
340
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
160
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
170
The Language of Interfaces
destraynor
162
26k
A Tale of Four Properties
chriscoyier
162
24k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
65
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
Transcript
Vugu: Go+WebAssemblyでつくる Omikuji-Go Tokyo, July 18 2024 Misato IT Engineer
@mikkegt
Today’s (glorious) blather. 自己紹介 01 コミュニティ活動 Vuguを使ったおみくじアプリ お披露目 Next Step
おわり 02 03 04 05 06
お仕事:アプリ保守してます(TSとJava) お楽しみ:ランチに天王洲アイル, 運河散策 01 自己紹介
テック系・地域コミュニティで活動してます • WomenWhoGoスタッフ • 一般社団法人SingularitySocietyスタッフ ◦ 無料で使えるテイクアウトサービスの運用 ◦ たまにVue.jsを書いてます、たまに •
地域コミュニティ 02 コミュニティ活動 https://omochikaeri.com/
omikuji-go アプリを作った👏 この日のために👏👏 03 Vuguを使ったおみくじアプリ(本題)
おみくじアプリです Go+WebAssemblyなライブラリVuguを使用しました
WebAssemblyとは • GoやC++,Rustなどのコンパイル言語で書いたコードを Web用のAssemblyにコンパイルしブラウザーで実行する 技術です • JavaScriptと比べ処理速度が速く、複雑な計算や3Dグラ フィックスなどの重い処理に適しています • JavaScriptと連携して使用することができ、既存のウェ
ブ技術と組み合わせて新しい可能性を広げています
プチ開発で採用したVugu • Vuguは、GoとWebAssemblyを使用してWebUIを構築す るための実験的なライブラリです • Vue.jsに触発された設計をもち、単一ファイルコンポー ネントやVue風のマークアップ構文を採用しています • Node.js、JavaScript、npmを使用せずに、純粋なGo コードでUIを開発できます
• WebAssemblyを利用してブラウザ上で動作し、高速なパ フォーマンスを実現します
Vuguのコード, JSの部分に Goを書くのダヨ <div> <div vg-if="c.message != nil"> <p vg-html="c.message"></p>
</div> </div> <script type="application/x-go"> import "hoge" type Root struct { message string } func (c *Root) hogehoge() { c.message = "hogehogehoge" } </script> 構造体 コンポーネントの状態管理 Vueのdataに相当 関数 Computedに相当 Watchに相当するもの はないけど実装は可 ディレクティブ
GoからDOM要素にアクセスできたりする <div> <canvas width="300" height="100" vg-js-populate="c.canvasPopulate(value)" ></canvas> </div> <script type="application/x-go">
type Root struct {} func (c *Root) canvasPopulate(value js.Value) { drawCtx := value.Call("getContext", "2d") drawCtx.Set("font", "30px Arial") drawCtx.Call("strokeText", "Hello from Vugu!", 10, 50) } </script>
omikuji-go お披露目 04 Vuguを使ったおみくじアプリ(Demo)
VuguはTinyGoでビルドできる //go:generate vugugen -tinygo ビルドしてCDNのWorkerに のせるのに挑戦したいかも 05 Next Step
ROB PIKE Go's purpose is to make its designers' programming
lives better.
おしまい Thankyou! https://www.vugu.org/ https://pkg.go.dev/github.com/vugu/vugu https://github.com/mikkegt/omikuji-go