mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-12-09 05:05:55 +08:00
Update broadcast_event in Kino.JS.Live guide (#894)
This commit is contained in:
parent
b9b901648c
commit
5c1c61d0f2
1 changed files with 3 additions and 5 deletions
|
|
@ -145,11 +145,8 @@ defmodule Kino.Leaflet do
|
|||
|
||||
@impl true
|
||||
def handle_cast({:add_marker, location}, ctx) do
|
||||
ctx =
|
||||
ctx
|
||||
|> broadcast_event("add_marker", location)
|
||||
|> update(:locations, &[location | &1])
|
||||
|
||||
broadcast_event(ctx, "add_marker", location)
|
||||
ctx = update(ctx, :locations, &[location | &1])
|
||||
{:noreply, ctx}
|
||||
end
|
||||
|
||||
|
|
@ -264,6 +261,7 @@ defmodule Kino.Counter do
|
|||
defp bump_count(ctx) do
|
||||
ctx = update(ctx, :count, &(&1 + 1))
|
||||
broadcast_event(ctx, "update", ctx.assigns.count)
|
||||
ctx
|
||||
end
|
||||
|
||||
asset "main.js" do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue