Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Vugu: Go+WebAssemblyでつくる Omikuji-Go
Search
Misato Kawano
July 20, 2024
58
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Vugu: Go+WebAssemblyでつくる Omikuji-Go
Misato Kawano
July 20, 2024
Transcript
14 slides
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
More Decks by Misato Kawano
See All by Misato Kawano
MulmoTerminal 今年に入ってから何回かターミナルを乗り換えた話
mikkegt
0
33
Gopherto
mikkegt
0
75
Featured
See All Featured
Code Review Best Practice
trishagee
74
20k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Amusing Abliteration
ianozsvald
1
410
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
73
43k
Building an army of robots
kneath
307
47k
Done Done
chrislema
187
17k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
760
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
4
1.3k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k