View Source Elph.Contents.Callbacks (elph v0.9.1)
In this file macros regarding custom callbacks are defined.
To use custom callbacks this module has to be use
d. Add elph_cleanup_callbacks()
to use the
default elph callbacks.
Now you can add one or more callbacks. For example cleanup_callback(&IO.inspect/1)
Each callback will be called with a list of explicitly deleted and garbage-colledted content
(without its children, as from Contents.list_contents
). So the above example would print a
list of the deleted contents on your console.
If you want to rerun the cleanup after all callbacks were run, return :cleanup
in your function.
Every other return will be ignored. Care not to produce infinity loops!
The use
ing file also has to be added to your config, to activate your callbacks:
config :elph, callbacks: <YourApp>.Callbacks