diff --git a/Project.toml b/Project.toml index 1a341c14..82ec2e17 100644 --- a/Project.toml +++ b/Project.toml @@ -24,7 +24,7 @@ AssetRegistry = "0.1.0" FunctionalCollections = "0.5.0" JSExpr = "0.5" JSON = "0.18, 0.19, 0.20, 0.21" -Observables = "0.3, 0.4, 0.5" +Observables = "0.4, 0.5" Requires = "0.4.4, 0.5, 1.0.0" WebSockets = "1.5.0" Widgets = "0.6.2" diff --git a/src/scope.jl b/src/scope.jl index f80a6bd5..92491e6d 100644 --- a/src/scope.jl +++ b/src/scope.jl @@ -332,31 +332,21 @@ struct SyncCallback end (s::SyncCallback)(xs...) = s.f(xs...) + """ Set observable without synchronizing with the counterpart on the browser. This is mostly used to update observables in response to updates sent from th browser (so that we aren't sending the same update *back* to the browser). """ -function set_nosync end - -if isdefined(Observables, :setexcludinghandlers) - # Observables <=0.3 - function set_nosync(ob, val) - Observables.setexcludinghandlers(ob, val, x -> !(x isa SyncCallback)) - return - end -else - # Observables >=0.4 - function set_nosync(ob, val) - Observables.setexcludinghandlers!(ob, val) - for f in listeners(ob) - if !(f isa SyncCallback) - Base.invokelatest(f, val) - end +function set_nosync(ob, val) + Observables.setexcludinghandlers!(ob, val) + for (_, f) in listeners(ob) + if !(f isa SyncCallback) + Base.invokelatest(f, val) end - return end + return end const lifecycle_commands = ["scope_created"]