概要
wsl(wsl2じゃない)で、elixirやってみた。
練習問題やってみた。
練習問題
Livebookの、kino.jsで、youtubeを動作させよ。
写真
サンプルコード
defmodule KinoHTML.Youtube do
use Kino.JS
def new(url) do
Kino.JS.new(__MODULE__, url)
end
asset "main.js" do
"""
export function init(ctx, url) {
const iframe = document.createElement("iframe");
iframe.setAttribute("src", url);
iframe.style.width = "100%";
iframe.style.height = "500px";
iframe.style.border = "0";
ctx.root.appendChild(iframe);
}
"""
end
end
KinoHTML.Youtube.new("https://www.youtube.com/embed/7MWJ83iIx4g")
以上。