Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Feb 1, 2020
1 parent 1c843ed commit face247
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/require.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Base: PkgId, loaded_modules, package_callbacks, @get!
using Base: PkgId, loaded_modules, package_callbacks
using Base.Meta: isexpr

export @require
Expand All @@ -10,7 +10,7 @@ loaded(pkg) = haskey(Base.loaded_modules, pkg)
const notified_pkgs = [Base.PkgId(UUID(0x295af30fe4ad537b898300126c2a3abe), "Revise")]

const _callbacks = Dict{PkgId, Vector{Function}}()
callbacks(pkg) = @get!(_callbacks, pkg, [])
callbacks(pkg) = get!(()->_callbacks, pkg, [])

listenpkg(@nospecialize(f), pkg) =
loaded(pkg) ? f() : push!(callbacks(pkg), f)
Expand Down

0 comments on commit face247

Please sign in to comment.