1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

wslでelixir その174

Posted at

概要

wsl(wsl2じゃない)で、elixirやってみた。
練習問題やってみた。

練習問題

Livebookの、kino.jsで、MMLを鳴らせ。

写真

image.png

サンプルコード

defmodule KinoHTML.Mml do
  use Kino.JS
	def new(mml) do
		Kino.JS.new(__MODULE__, mml)
	end
	asset "main.js" do
		"""
		export async function init(ctx, mml) {
      await ctx.importJS("https://kazuprog.work/prog/js/mml-player/mml-player.js")
      var mml = mml;
      ctx.root.innerHTML = `
        	<button id="bt0">run</button>
			`;
			const bt0 = document.getElementById("bt0");
  		bt0.addEventListener("click", (event) => {
        new MMLPlayer().play(mml);
    	});
	
    }
    """
  end
end

KinoHTML.Mml.new("t110 l8 r4rcf4.ffedcd4.ccracd4dddfdea2 r4acd4dfg4fef4edd4rcd4rddafg2. ")


以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?