Skip to content

Commit

Permalink
fix @onbutton
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Nov 28, 2024
1 parent 849a4a0 commit 2708e3d
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/ReactiveTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -829,16 +829,10 @@ macro onchange(location, vars, expr)
expr = unmask(expr, vcat(known_reactive_vars, known_non_reactive_vars))

fn = length(vars.args) == 1 ? :on : :onany
ex = quote
$fn($(on_vars.args...)) do _...
:($fn($(on_vars.args...)) do _...
$(expr.args...)
end
end

output = [ex]
quote
$output[end]
end |> esc
) |> QuoteNode
end

macro onchangeany(var, expr)
Expand Down Expand Up @@ -879,7 +873,7 @@ macro onbutton(var, expr)
end

macro onbutton(location, var, expr)
loc::Union{Module, Type{<:ReactiveModel}} = @eval __module__ $location
loc::Union{Module, Type{<:ReactiveModel}, LittleDict} = @eval __module__ $location
expr = wrap(expr, :block)

known_reactive_vars, known_non_reactive_vars = get_known_vars(loc)
Expand All @@ -894,7 +888,7 @@ macro onbutton(location, var, expr)

:(onbutton($var) do
$(expr.args...)
end) |> esc
end) |> QuoteNode
end

#===#
Expand Down

0 comments on commit 2708e3d

Please sign in to comment.