defmodule LivebookWeb.SessionLive.RuntimeComponent do
use LivebookWeb, :live_component
alias Livebook.{Session, Runtime}
@impl true
def mount(socket) do
{:ok, assign(socket, type: nil)}
end
@impl true
def update(assigns, socket) do
assigns =
if socket.assigns.type == nil do
type =
if assigns.runtime do
runtime_type(assigns.runtime)
else
"elixir_standalone"
end
Map.put(assigns, :type, type)
else
assigns
end
{:ok, assign(socket, assigns)}
end
@impl true
def render(assigns) do
~L"""
Runtime
The code is evaluated in a separate Elixir runtime (node),
which you can configure yourself here.