-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update docs on nested Kino.start_child/1 #452
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,44 +202,8 @@ defmodule Kino.JS.Live do | |
|
||
See `c:GenServer.init/1` for more details. | ||
|
||
> #### Starting other kinos {: .warning} | ||
> | ||
> It is generally not possible to start kinos inside the `c:init/2` | ||
> callback, as such operation would block forever. In case you need | ||
> to start other kinos during initialization, you must start them | ||
> beforehand and pass as an argument to `c:init/2`. So instead of | ||
> | ||
> defmodule KinoDocs.Custom do | ||
> def new() do | ||
> Kino.JS.Live.new(__MODULE__, {}) | ||
> end | ||
> | ||
> @impl true | ||
> def init({}, ctx) do | ||
> frame = Kino.Frame.new() | ||
> {:ok, assign(ctx, frame: frame)} | ||
Comment on lines
-219
to
-220
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This example is confusing, we create a frame in I think it's more about creating kinos like |
||
> end | ||
> | ||
> ... | ||
> end | ||
> | ||
> do the following | ||
> | ||
> defmodule KinoDocs.Custom do | ||
> def new() do | ||
> frame = Kino.Frame.new() | ||
> Kino.JS.Live.new(__MODULE__, {frame}) | ||
> end | ||
> | ||
> @impl true | ||
> def init({frame}, ctx) do | ||
> {:ok, assign(ctx, frame: frame)} | ||
> end | ||
> | ||
> ... | ||
> end | ||
> | ||
> Also see `Kino.start_child/1`. | ||
If you want to create other kinos on initialization, see the | ||
limitations described in `Kino.start_child/1`. | ||
""" | ||
@callback init(arg :: term(), ctx :: Context.t()) :: | ||
{:ok, ctx :: Context.t()} | {:ok, ctx :: Context.t(), opts :: keyword()} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhh, didn't know it was possible to do that inside
handle_continue
! 💡