Skip to content

Commit

Permalink
pass stuff to json output
Browse files Browse the repository at this point in the history
  • Loading branch information
BeastyBlacksmith committed Apr 4, 2024
1 parent cf15afa commit 4530994
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/app/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ end
function _callback!(func::Union{Function, ClientsideFunction, String}, app::DashApp, deps::CallbackDeps;
prevent_initial_call = nothing,
background = false,
interval = 1000,
manager = nothing)

check_callback(func, app, deps)
Expand All @@ -142,7 +143,8 @@ function _callback!(func::Union{Function, ClientsideFunction, String}, app::Dash
isnothing(prevent_initial_call) ?
get_setting(app, :prevent_initial_callbacks) :
prevent_initial_call,
background
background,
interval
)
)
end
Expand Down
3 changes: 2 additions & 1 deletion src/app/supporttypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ struct Callback
func ::Union{Function, ClientsideFunction}
dependencies ::CallbackDeps
prevent_initial_call ::Bool
background ::Bool
long ::Bool
interval ::Int
end

is_multi_out(cb::Callback) = cb.dependencies.multi_out == true
Expand Down
3 changes: 2 additions & 1 deletion src/handler/state.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ function _dependencies_json(app::DashApp)
state = dependency_tuple.(callback.dependencies.state),
output = output_string(callback.dependencies),
clientside_function = _dep_clientside_func(callback.func),
prevent_initial_call = callback.prevent_initial_call
prevent_initial_call = callback.prevent_initial_call,
long = callback.long && (interval = callback.interval)
)
end
return JSON3.write(result)
Expand Down
1 change: 1 addition & 0 deletions test/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -674,4 +674,5 @@ end
request = HTTP.Request("GET", "/_dash-dependencies")
resp = Dash.HttpHelpers.handle(handler, request)
deps = JSON3.read(String(resp.body))
@test deps[1].long
end

0 comments on commit 4530994

Please sign in to comment.