SlideShare una empresa de Scribd logo
1 de 29
Scala.js
Web
mogproject Presents
2018/04/03@ Geek Night #17
https://mogproject.com
▸ 2
▸ /
Why North Carolina?
▸
▸ : IBM, SAS, Red Hat, Cisco, ...
▸
▸
▸
▸
▸
© TripAdvisor
(1)
▸ Facility Location Problems: the p-median problem
▸ 



(p)
▸ NP
▸ Linear Programming
▸ p-median 

▸ Dr. Matthias F. Stallmann / Dr. Aissa Oudjit @ North Carolina State University
(2)
▸ IBM Watson
▸ Abstract
▸ : / IBM
▸ ICACON 2018 (5/24-26 ) 

https://www.ibm.com/solutions/education/cloudacademy/us/en/cloud_academy_conference_2018.html
▸ Shogi Playground
▸ https://play.mogproject.com/
▸ / /
▸ Shogi Playground Live!
▸ https://live.mogproject.com/
▸ /
▸ Shogi Bot
▸ https://www.facebook.com/shogibot/
▸ Facebook Messenger
Scala.js
Scala
Scala.js Scala
Shogi Bot
‣ Shogi Playground
Shogi Playground
Shogi Playground
Agenda
Shogi Playground
▸ (Firefox / Chrome /Safari ) URL 

https://play.mogproject.com
▸
▸
▸
▸
▸
Shogi Playground
▸
▸
▸ ( / )
Shogi Playground
▸ Flash
▸ : Web 

http://www.shogi.pl/level-1-shogi-course/lesson-two-the-pieces/
Shogi Playground
‣ Shogi Playground
Shogi Playground
Agenda
Shogi Playground
▸
▸ Scala
▸
▸ SAM
▸ ( )
▸
▸
▸ (SVG) ( )
Shogi Playground
Scala
▸ I/O (mog-core-scala)
▸ /
mog-core-scala
mog-frontend mog-fb-bot
mog-live
Shogi Playground Shogi Playground Live! Shogi Bot
Scala.js
Scala
ScalaScala.js
Scala.js
Scala
https://github.com/mogproject/mog-core-scala
https://github.com/mogproject/mog-frontend
https://github.com/
mogproject/mog-playground
mog-playground
Scala.js
Shogi Playground
▸ (GitHub Pages )
▸
▸ No
▸
▸ 

https://github.com/mogproject/mog-playground/wiki/Query-Parameters
Shogi Playground
USEN (Url Safe sfen-Extended Notation)
▸
▸ URL
~ ~ 1 ~ 2
[ …]
. 1 ][ 2 …] .
[
. 1 ][ 2 …] .
[
Shogi Playground
USEN (Url Safe sfen-Extended Notation)
▸
▸ -> "" ( )
▸ -> SFEN
▸ '/' -> '_', ' ' ( ) -> '.', '+' -> 'z'
▸ : lnsgk2nl_1r4gs1_p1pppp1pp_1p4p2_7P1_2P6_PP1PPPP1P_1SG4R1_LN2KGSNL.b.Bb
https://en.wikipedia.org/wiki/Shogi_notation#SFEN
Shogi Playground
USEN (Url Safe sfen-Extended Notation)
▸
▸
▸ : 1 - 1
▸ :
. 1
][ 2
…].
[
Shogi Playground
USEN (Url Safe sfen-Extended Notation)
▸
▸
▸ ( * 81 + ) * 2 + ( 1)
▸ 3 36 ([0-9a-z])
▸
▸ : 0 (1 ) 80 (9 )
▸ : 81 + ( ->10, ->11, ->12, ->13, ->9, ->14, ->15,
->8, ->2, ->3, ->4, ->5, ->6, ->7)
▸ : 0 (1 ) 80 (9 )
Shogi Playground
USEN (Url Safe sfen-Extended Notation)
▸
▸ : "i"
▸ : "r"
▸ : "t"
▸ : "p"
▸ : "j"
▸ USEN :

~0.7ku36e7bq0rs83q0io9lo4be8uc31u9us1sc7ga1im8la09o8cm20u88231s8hc46u7lw5bu7gc2jm9cm2sq6ti
bgu8pu1bs6gs6cd8uc05m5oi0dm7ls09k8ko0nabfs41cbfc30w60x1weby62xa61s21w40hbzebtc4ae10y35q2
4w2k60vubds7h88vh5as2r845v1scbj80i22rr1j441d2f20s8a4e2sq9y8boqbmmbca67s8gs1ek3xobao4wsc381
n67cb2vobim9q87ga1i4bgqboo3t6517bp092i6bi2n4bv08443k21e22f20ek3k42em.r



-> https://goo.gl/QXZJkP
Shogi Playground
JavaScript
1. jQuery / Bootstrap
2. Google APIs Client Library for JavaScript
‣ URL Shortener
3. clipboard.js
‣
4. FileSaver.js
‣
5. lz-string.js
‣ /
6. ecl_new.js
‣ ( )
Scala JS
( )
package com.mogproject.mogami.frontend.api
import org.scalajs.dom.{Element, NodeListOf}
import scala.scalajs.js
import scala.scalajs.js.annotation.JSGlobal
import scala.scalajs.js.|
@js.native
@JSGlobal("Clipboard")
class Clipboard(selector: String | Element | NodeListOf[Element] = js.native,
options: Clipboard.Options = js.native) extends js.Object {
def on(`type`: String, handler: js.Function): Clipboard = js.native
def destroy(): Unit = js.native
}
@js.native
@JSGlobal("Clipboard")
object Clipboard extends js.Object {
@js.native
trait Options extends js.Object {
var action: js.Function1[Element, String] = js.native
var target: js.Function1[Element, Element] = js.native
var text: js.Function1[Element, String] = js.native
}
@js.native
trait Event extends js.Object {
var action: String = js.native
var text: String = js.native
var trigger: Element = js.native
def clearSelection(): Unit = js.native
}
}
https://github.com/mogproject/mog-frontend/blob/master/src/main/scala/
com/mogproject/mogami/frontend/api/Clipboard.scala
Shogi Playground
SAM (State - Action - Model)
▸ http://sam.js.org/ by Jean-Jacques Dubray
▸
▸ V = f(M)
▸ Model(M):
▸ State(S): Model View 

Action
▸ Action(A): API 

Shogi Playground
SAM
▸ State: Model View
trait SAMState[M <: SAMModel] {
def model: M
def view: SAMView
def render(newModel: M): (SAMState[M], Option[SAMAction[M]])
}
Shogi Playground
SAM
▸ View : SAM.doAction(SomeAction(data))
class SAM[M <: SAMModel](private[this] var state: SAMState[M]){
def doAction(action: SAMAction[M]): Unit = {
val result: Option[M] = action.execute(state.model)
result match {
case Some(nextModel) =>
val (nextState, nextAction) = state.render(nextModel)
state = nextState
nextAction match {
case Some(a) => doAction(a)
case None =>
}
case None =>
}
}
}
: https://github.com/mogproject/mog-frontend/blob/master/src/main/scala/com/mogproject/mogami/frontend/sam/SAM.scala
Shogi Playground
▸
▸ 

▸ JVM / JS
▸ ( ) 

&
▸ LocalStorage
Shogi Playground
Shogi Playground
‣ Shogi Playground
Agenda
Shogi Playground
(1)
▸
▸ URI 2000
▸ / Google URL Shortener
▸
▸ ( )
▸ /
Shogi Playground
(2)
▸ ( / )
▸
▸
▸ YouTube (YouTuber !?)
▸ Scala.js 

Web
▸ / Scala
▸ JavaScript
▸ SAM ( )
Thank you!
▸ Shogi Playground



https://play.mogproject.com
▸
▸ Twitter -> https://twitter.com/mogproject
▸ GitHub Issues -> https://github.com/mogproject/mog-playground/issues

Más contenido relacionado

Similar a フロントエンド初心者の大学生が Scala.js で Web アプリを作ってみた話

โครงงานคอมพิวเตอร์
โครงงานคอมพิวเตอร์โครงงานคอมพิวเตอร์
โครงงานคอมพิวเตอร์
tatumoxlxo
 
Data URIs
Data URIsData URIs
Data URIs
Rillus
 
Earth gracia noida extension article list
Earth gracia noida extension article listEarth gracia noida extension article list
Earth gracia noida extension article list
nehat2f
 

Similar a フロントエンド初心者の大学生が Scala.js で Web アプリを作ってみた話 (20)

ET WEST「オープンソースを使った国産フライトコントローラ開発 プロジェクトの概要」(2017-07-13)
ET WEST「オープンソースを使った国産フライトコントローラ開発 プロジェクトの概要」(2017-07-13)ET WEST「オープンソースを使った国産フライトコントローラ開発 プロジェクトの概要」(2017-07-13)
ET WEST「オープンソースを使った国産フライトコントローラ開発 プロジェクトの概要」(2017-07-13)
 
Edge trends mizuno-template
Edge trends mizuno-templateEdge trends mizuno-template
Edge trends mizuno-template
 
Tayninhcity: Bản tin Tây Ninh
Tayninhcity: Bản tin Tây NinhTayninhcity: Bản tin Tây Ninh
Tayninhcity: Bản tin Tây Ninh
 
Code Quality
Code QualityCode Quality
Code Quality
 
Eficiency and Low Cost: Pro Tips for you to save 50% of your money with Googl...
Eficiency and Low Cost: Pro Tips for you to save 50% of your money with Googl...Eficiency and Low Cost: Pro Tips for you to save 50% of your money with Googl...
Eficiency and Low Cost: Pro Tips for you to save 50% of your money with Googl...
 
Deploying DNSSEC at Scale
Deploying DNSSEC at ScaleDeploying DNSSEC at Scale
Deploying DNSSEC at Scale
 
Zurag
ZuragZurag
Zurag
 
โครงงานคอมพิวเตอร์
โครงงานคอมพิวเตอร์โครงงานคอมพิวเตอร์
โครงงานคอมพิวเตอร์
 
機械学習と自動微分
機械学習と自動微分機械学習と自動微分
機械学習と自動微分
 
Bản tin Lâm Đồng
Bản tin Lâm ĐồngBản tin Lâm Đồng
Bản tin Lâm Đồng
 
Edge trends mizuno
Edge trends mizunoEdge trends mizuno
Edge trends mizuno
 
Bản tin Bình Thuận binhthuan.city
Bản tin Bình Thuận binhthuan.cityBản tin Bình Thuận binhthuan.city
Bản tin Bình Thuận binhthuan.city
 
Andrew's geo media evolution
Andrew's geo media evolutionAndrew's geo media evolution
Andrew's geo media evolution
 
Data URIs
Data URIsData URIs
Data URIs
 
What's new in Spring Batch 5
What's new in Spring Batch 5What's new in Spring Batch 5
What's new in Spring Batch 5
 
Earth gracia noida extension article list
Earth gracia noida extension article listEarth gracia noida extension article list
Earth gracia noida extension article list
 
Responses students self assessment
Responses   students self assessmentResponses   students self assessment
Responses students self assessment
 
Ocul emergency-presentation
Ocul emergency-presentationOcul emergency-presentation
Ocul emergency-presentation
 
Ocul emergency-presentation
Ocul emergency-presentationOcul emergency-presentation
Ocul emergency-presentation
 
Mood board
Mood boardMood board
Mood board
 

Más de Yosuke Mizutani (6)

Introduction to Graph Theory
Introduction to Graph TheoryIntroduction to Graph Theory
Introduction to Graph Theory
 
Spark GraphX で始めるグラフ解析
Spark GraphX で始めるグラフ解析Spark GraphX で始めるグラフ解析
Spark GraphX で始めるグラフ解析
 
はじめての CircleCI
はじめての CircleCIはじめての CircleCI
はじめての CircleCI
 
Adtech x Scala x Performance tuning
Adtech x Scala x Performance tuningAdtech x Scala x Performance tuning
Adtech x Scala x Performance tuning
 
ScalaにまつわるNewsな話
ScalaにまつわるNewsな話ScalaにまつわるNewsな話
ScalaにまつわるNewsな話
 
アドテク×Scala×パフォーマンスチューニング
アドテク×Scala×パフォーマンスチューニングアドテク×Scala×パフォーマンスチューニング
アドテク×Scala×パフォーマンスチューニング
 

Último

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Último (20)

Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 

フロントエンド初心者の大学生が Scala.js で Web アプリを作ってみた話

  • 3. Why North Carolina? ▸ ▸ : IBM, SAS, Red Hat, Cisco, ... ▸ ▸ ▸ ▸ ▸ © TripAdvisor
  • 4. (1) ▸ Facility Location Problems: the p-median problem ▸ 
 
 (p) ▸ NP ▸ Linear Programming ▸ p-median 
 ▸ Dr. Matthias F. Stallmann / Dr. Aissa Oudjit @ North Carolina State University
  • 5. (2) ▸ IBM Watson ▸ Abstract ▸ : / IBM ▸ ICACON 2018 (5/24-26 ) 
 https://www.ibm.com/solutions/education/cloudacademy/us/en/cloud_academy_conference_2018.html
  • 6. ▸ Shogi Playground ▸ https://play.mogproject.com/ ▸ / / ▸ Shogi Playground Live! ▸ https://live.mogproject.com/ ▸ / ▸ Shogi Bot ▸ https://www.facebook.com/shogibot/ ▸ Facebook Messenger Scala.js Scala Scala.js Scala Shogi Bot
  • 7. ‣ Shogi Playground Shogi Playground Shogi Playground Agenda
  • 8. Shogi Playground ▸ (Firefox / Chrome /Safari ) URL 
 https://play.mogproject.com ▸ ▸ ▸ ▸ ▸
  • 10. Shogi Playground ▸ Flash ▸ : Web 
 http://www.shogi.pl/level-1-shogi-course/lesson-two-the-pieces/
  • 11. Shogi Playground ‣ Shogi Playground Shogi Playground Agenda
  • 12. Shogi Playground ▸ ▸ Scala ▸ ▸ SAM ▸ ( ) ▸ ▸ ▸ (SVG) ( )
  • 13. Shogi Playground Scala ▸ I/O (mog-core-scala) ▸ / mog-core-scala mog-frontend mog-fb-bot mog-live Shogi Playground Shogi Playground Live! Shogi Bot Scala.js Scala ScalaScala.js Scala.js Scala https://github.com/mogproject/mog-core-scala https://github.com/mogproject/mog-frontend https://github.com/ mogproject/mog-playground mog-playground Scala.js
  • 14. Shogi Playground ▸ (GitHub Pages ) ▸ ▸ No ▸ ▸ 
 https://github.com/mogproject/mog-playground/wiki/Query-Parameters
  • 15. Shogi Playground USEN (Url Safe sfen-Extended Notation) ▸ ▸ URL ~ ~ 1 ~ 2 [ …] . 1 ][ 2 …] . [ . 1 ][ 2 …] . [
  • 16. Shogi Playground USEN (Url Safe sfen-Extended Notation) ▸ ▸ -> "" ( ) ▸ -> SFEN ▸ '/' -> '_', ' ' ( ) -> '.', '+' -> 'z' ▸ : lnsgk2nl_1r4gs1_p1pppp1pp_1p4p2_7P1_2P6_PP1PPPP1P_1SG4R1_LN2KGSNL.b.Bb https://en.wikipedia.org/wiki/Shogi_notation#SFEN
  • 17. Shogi Playground USEN (Url Safe sfen-Extended Notation) ▸ ▸ ▸ : 1 - 1 ▸ : . 1 ][ 2 …]. [
  • 18. Shogi Playground USEN (Url Safe sfen-Extended Notation) ▸ ▸ ▸ ( * 81 + ) * 2 + ( 1) ▸ 3 36 ([0-9a-z]) ▸ ▸ : 0 (1 ) 80 (9 ) ▸ : 81 + ( ->10, ->11, ->12, ->13, ->9, ->14, ->15, ->8, ->2, ->3, ->4, ->5, ->6, ->7) ▸ : 0 (1 ) 80 (9 )
  • 19. Shogi Playground USEN (Url Safe sfen-Extended Notation) ▸ ▸ : "i" ▸ : "r" ▸ : "t" ▸ : "p" ▸ : "j" ▸ USEN :
 ~0.7ku36e7bq0rs83q0io9lo4be8uc31u9us1sc7ga1im8la09o8cm20u88231s8hc46u7lw5bu7gc2jm9cm2sq6ti bgu8pu1bs6gs6cd8uc05m5oi0dm7ls09k8ko0nabfs41cbfc30w60x1weby62xa61s21w40hbzebtc4ae10y35q2 4w2k60vubds7h88vh5as2r845v1scbj80i22rr1j441d2f20s8a4e2sq9y8boqbmmbca67s8gs1ek3xobao4wsc381 n67cb2vobim9q87ga1i4bgqboo3t6517bp092i6bi2n4bv08443k21e22f20ek3k42em.r
 
 -> https://goo.gl/QXZJkP
  • 20. Shogi Playground JavaScript 1. jQuery / Bootstrap 2. Google APIs Client Library for JavaScript ‣ URL Shortener 3. clipboard.js ‣ 4. FileSaver.js ‣ 5. lz-string.js ‣ / 6. ecl_new.js ‣ ( ) Scala JS ( ) package com.mogproject.mogami.frontend.api import org.scalajs.dom.{Element, NodeListOf} import scala.scalajs.js import scala.scalajs.js.annotation.JSGlobal import scala.scalajs.js.| @js.native @JSGlobal("Clipboard") class Clipboard(selector: String | Element | NodeListOf[Element] = js.native, options: Clipboard.Options = js.native) extends js.Object { def on(`type`: String, handler: js.Function): Clipboard = js.native def destroy(): Unit = js.native } @js.native @JSGlobal("Clipboard") object Clipboard extends js.Object { @js.native trait Options extends js.Object { var action: js.Function1[Element, String] = js.native var target: js.Function1[Element, Element] = js.native var text: js.Function1[Element, String] = js.native } @js.native trait Event extends js.Object { var action: String = js.native var text: String = js.native var trigger: Element = js.native def clearSelection(): Unit = js.native } } https://github.com/mogproject/mog-frontend/blob/master/src/main/scala/ com/mogproject/mogami/frontend/api/Clipboard.scala
  • 21. Shogi Playground SAM (State - Action - Model) ▸ http://sam.js.org/ by Jean-Jacques Dubray ▸ ▸ V = f(M) ▸ Model(M): ▸ State(S): Model View 
 Action ▸ Action(A): API 

  • 22. Shogi Playground SAM ▸ State: Model View trait SAMState[M <: SAMModel] { def model: M def view: SAMView def render(newModel: M): (SAMState[M], Option[SAMAction[M]]) }
  • 23. Shogi Playground SAM ▸ View : SAM.doAction(SomeAction(data)) class SAM[M <: SAMModel](private[this] var state: SAMState[M]){ def doAction(action: SAMAction[M]): Unit = { val result: Option[M] = action.execute(state.model) result match { case Some(nextModel) => val (nextState, nextAction) = state.render(nextModel) state = nextState nextAction match { case Some(a) => doAction(a) case None => } case None => } } } : https://github.com/mogproject/mog-frontend/blob/master/src/main/scala/com/mogproject/mogami/frontend/sam/SAM.scala
  • 24. Shogi Playground ▸ ▸ 
 ▸ JVM / JS ▸ ( ) 
 & ▸ LocalStorage
  • 25. Shogi Playground Shogi Playground ‣ Shogi Playground Agenda
  • 26. Shogi Playground (1) ▸ ▸ URI 2000 ▸ / Google URL Shortener ▸ ▸ ( ) ▸ /
  • 27. Shogi Playground (2) ▸ ( / ) ▸ ▸ ▸ YouTube (YouTuber !?)
  • 28. ▸ Scala.js 
 Web ▸ / Scala ▸ JavaScript ▸ SAM ( )
  • 29. Thank you! ▸ Shogi Playground
 
 https://play.mogproject.com ▸ ▸ Twitter -> https://twitter.com/mogproject ▸ GitHub Issues -> https://github.com/mogproject/mog-playground/issues