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
fukuoka_kt_1
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
gupuru
July 05, 2017
Technology
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
fukuoka_kt_1
https://cdg.connpass.com/event/60570/
gupuru
July 05, 2017
More Decks by gupuru
See All by gupuru
ng-fukuoka-meetup-1
gupuru
0
440
AngularとAzureのCustom Vision Serviceを使って 画像認識サイトを作ってみた
gupuru
0
680
紙について少し詳しくなる10分間
gupuru
0
410
make bot, fun bot
gupuru
0
340
firebase勉強会資料
gupuru
3
790
iOS and Android SVG
gupuru
0
380
Firebaseについて
gupuru
1
230
BLEを使って、すれ違い通信をやってみるよー
gupuru
0
2.3k
HiyokoDeveloperMeeting
gupuru
1
150
Other Decks in Technology
See All in Technology
ユーザー価値を届け続けるためにウォンテッドリーが大切にしている文化
kotaminato
0
160
OpenTelemetry eBPF Instrumentationの舞台裏 / Behind the Scenes of OpenTelemetry eBPF Instrumentation
ymotongpoo
4
1.3k
20260912_スクフェス三河
kgnkhkr
0
380
The Agent Builder Loop from Daily Work to OSS
minorun365
PRO
3
200
AI に書かせたその API、 “信頼” できますか?
nagix
0
110
映像変換サーバーなしで端末内でHLSを生成してライブ配信
hikarusato
0
110
DEFCON34-Write-up_HYCu-MYCu
daikiokazaki
0
160
2026-09-11 【Snowflake World Tour Tokyo 2026】Snowflakeを起点に、AI Agentが自律稼働し続ける未来へ / Driving AI Agents with Snowflake
civitaspo
0
550
アプリをもっと"iOSアプリっぽく"する小さな工夫 / Small Touches That Make Your App Feel More Like an iOS App
matsuji
1
900
HHKBエバンジェリストになる方法
941
0
110
Claude Code本って、 読む必要あるの?
oikon48
2
460
Omarchy Quattro の日本語設定周り
simosako
2
180
Featured
See All Featured
A Tale of Four Properties
chriscoyier
163
24k
Visualization
eitanlees
152
17k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
480
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
3
4.3k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
430
Making the Leap to Tech Lead
cromwellryan
135
10k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k
We Have a Design System, Now What?
morganepeng
55
8.3k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
280
Transcript
WebͰKotlinʂ Kotlin to JavaScript
About me ৽ݟ ߊฏ ϑϩϯτΤϯυͱػցֶशͷΤϯδχΞʹͳΖ͏ͱؤு͍ͬͯ ·͢(ʆɾωɾ´) • Twitter: @gupuru •
GitHub: gupuru
None
Kotlin 1.1ͰɺJavaScriptαϙʔτ͞Ε·ͨ͠ʂ JavaScript͕kotlinͰॻ͚·͢(ʆɾТɾ´) https://blog.jetbrains.com/jp/2017/03/01/739
ͪͳΈʹɺ͜Εࢼͨ͜͠ͱ͕͋Δਓɺ ڍखϊʢসʣ
͡ΊʹಋೖͩΑ(ʆɾТɾ´)
͜ͷ4ͭͷํ๏͕͋ΔΑ(ʆɾТɾ´) • Gradle • Maven • IntelliJ IDEA • Command
Line
IntelliJ IDEA
࠷ॳɺ͜Μͳײ͡ͷϓϩδΣΫτߏ͓ͩ(ʆɾТɾ´)
Build͢Δͱɺout͕Ͱ͖Δ͓(ʆɾТɾ´)
Buildͯ͠ɺͰ͖ͨϑΝΠϧΛHTMLଆͰݺΜͰ͋͛Δͱ͑Δ͓(ʆɾТɾ´) <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>ΘΜ͜</title> </head>
<body> <script type="text/javascript" src="out/production/wanko/lib/kotlin.js"></script> <script type="text/javascript" src="out/production/wanko/wanko.js"></script> </body> </html>
Γͷํ๏ɺ͜͜ݟͯ(ʆɾТɾ´) https://kotlinlang.org/docs/tutorials/javascript/kotlin-to-javascript/kotlin-to-javascript.html
࣮ࡍʹॻ͍ͯΈΔΑ(ʆɾТɾ´)
͜Μͳײ͡ʹॻ͘Α(ʆɾТɾ´) fun main(args: Array<String>) { val message = "͍͵ɺ͔Θ͍͍" println(message)
}
HTML͜Μͳײ͡(ʆɾТɾ´) <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>wanko</title> </head>
<body> <script type="text/javascript" src="out/production/inukawaii/lib/kotlin.js"></script> <script type="text/javascript" src="out/production/inukawaii/inukawaii.js"></script> </body> </html>
͜Μͳײ͡ʹม͞Ε͍ͯΔΑ(ʆɾТɾ´) if (typeof kotlin === 'undefined') { throw new Error("Error
loading module 'kotlinJS'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'kotlinJS'."); } var kotlinJS = function (_, Kotlin) { 'use strict'; var println = Kotlin.kotlin.io.println_s8jyv4$; function main(args) { var message = '\u3044\u306C\u3001\u304B\u308F\u3044\u3044'; println(message); } _.main_kand9s$ = main; Kotlin.defineModule('kotlinJS', _); main([]); return _; }(typeof kotlinJS === 'undefined' ? {} : kotlinJS, kotlin);
গ͚ͩ͠ಈ͖͚ͭͯΈΔ͓(ʆɾТɾ´)
kotlin͓ͩ(ʆɾТɾ´) fun main(args: Array<String>) { val inputText: HTMLInputElement = document.getElementById("inputText")
as HTMLInputElement val button: HTMLButtonElement = document.getElementById("button") as HTMLButtonElement button.onclick = { window.alert(inputText.value) } }
HTML͓ͩ(ʆɾТɾ´) <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>ΘΜΘΜ</title> </head>
<body> <input id="inputText" type="text" value="" title="ͳʹ͔͍Εͨ·͑"> <button id="button">͋Βʔͱͩ͢Α</button> <script type="text/javascript" src="out/production/kotlinJS/lib/kotlin.js"></script> <script type="text/javascript" src="out/production/kotlinJS/kotlinJS.js"></script> </body> </html>
͜Μͳײ͡ม͞Ε͍ͯΔΑ(ʆɾТɾ´) if (typeof kotlin === 'undefined') { throw new Error("Error
loading module 'kotlinJS'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'kotlinJS'."); } var kotlinJS = function (_, Kotlin) { 'use strict'; function main$lambda(closure$inputText) { return function (it) { window.alert(closure$inputText.value); }; } function main(args) { var tmp$, tmp$_0; var inputText = Kotlin.isType(tmp$ = document.getElementById('inputText'), HTMLInputElement) ? tmp$ : Kotlin.throwCCE(); var button = Kotlin.isType(tmp$_0 = document.getElementById('button'), HTMLButtonElement) ? tmp$_0 : Kotlin.throwCCE(); button.onclick = main$lambda(inputText); } _.main_kand9s$ = main; main([]); Kotlin.defineModule('kotlinJS', _); return _; }(typeof kotlinJS === 'undefined' ? {} : kotlinJS, kotlin);
͞Βʹಈ͖͚ͭͯΈΔΑ(ʆɾТɾ´)
NodeͷαʔόΛͨͯͯΈΔ͓(ʆɾТɾ´)
package.json͓ͩ(ʆɾТɾ´) { "name": "wankoserver", "version": "1.0.0", "description": "", "main": "index.js",
"scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "gupuru", "license": "MIT", "dependencies": { "express": "^4.15.3", "kotlin": "^1.1.0" } }
gradle͓ͩ(ʆɾТɾ´) group 'wanko-express' version '1.0' buildscript { ext.kotlin_version = '1.1.1'
repositories { mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } apply plugin: 'kotlin2js' repositories { mavenCentral() } dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" } compileKotlin2Js.kotlinOptions { moduleKind = "commonjs" outputFile = "node/index.js" }
kotlin͓ͩ(ʆɾТɾ´) external fun require(module:String):dynamic fun main(args: Array<String>) { println("wanwan start")
val express = require("express") val app = express() app.get("/", { req, res -> res.type("text/plain") res.send("wanko kawaii") }) app.listen(3000, { println("port: 3000") }) }
͜Μͳײ͡ม͞Ε͍ͯΔ͓(ʆɾТɾ´) (function (_, Kotlin) { 'use strict'; var println =
Kotlin.kotlin.io.println_s8jyv4$; function main$lambda(req, res) { res.type('text/plain'); return res.send('wanko kawaii'); } function main$lambda_0() { println('port: 3000'); } function main(args) { println('wanwan start'); var express = require('express'); var app = express(); app.get('/', main$lambda); app.listen(3000, main$lambda_0); } _.main_kand9s$ = main; Kotlin.defineModule('index', _); main([]); return _; }(module.exports, require('kotlin')));
ৄ͘͠ɺ͜͜Έͯ(ʆɾТɾ´) • https://github.com/miquelbeltran/kotlin-node.js
·ͱΊ
Kotlinָ͍͠(ʆŋТŋ´)
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ