module Zeitwerk::Loader::Config

def on_load(cpath = :ANY, &block)

: (String?) { (top, String) -> void } -> void ! TypeError

end
# ...
loader.on_load do |cpath, value, abspath|

Can also be configured for any constant loaded:

end
klass.endpoint = "https://api.dev"
loader.on_load("SomeApiClient") do |klass, _abspath|

the order in which they were defined.
Supports multiple callbacks, and if there are many, they are executed in
Configure a block to be invoked once a certain constant path is loaded.
def on_load(cpath = :ANY, &block)
  raise TypeError, "on_load only accepts strings" unless cpath.is_a?(String) || cpath == :ANY
  mutex.synchronize do
    (on_load_callbacks[cpath] ||= []) << block
  end
end