diff --git a/README.md b/README.md index dc6e028..1f6b211 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,16 @@ The option disabled in the OptionPlist will disable the plugin at load time. Callbacks ========= + +notation +-------- +callbacks are noted as `(arguments)` so `eplugin:init(Config)` means the callback `eplugin:init` is caled with 1 argument - `Config`. + +internal callbacks +------------------ eplugin provides the following callbacks itself: -* eplugin:init - this is called when all modules are compiled. The Plugins config is passed. -* eplugin:enable - this is called before a module gets enabled. The Plugins config is passed. -* eplugin:disable - this gets called after a module gets disabled. The Plugins config is passed. \ No newline at end of file +* eplugin:init(Config) - this is called when all modules are compiled. +* eplugin:enable(Config) - this is called before a module gets enabled. +* eplugin:disable(Config) - this gets called after a module gets disabled. +* eplugin:enable_plugin(Plugin) - this gets called whenever a plugin is enabled. +* eplugin:disable_plugin(Plugin) - this gets called whenever a plugin is disabled. diff --git a/src/eplugin.erl b/src/eplugin.erl index a84a693..dfe23a7 100644 --- a/src/eplugin.erl +++ b/src/eplugin.erl @@ -153,6 +153,7 @@ disable(Plugin) -> ets:match_delete(?TABLE, {'_', Plugin, '_', '_'}), {ok, Config} = config(Plugin), [erlang:apply(M, F, [Config]) || [M, F] <- Callback], + eplugin:apply('eplugin:disable_plugin', [Plugin]), ok; false -> lager:warning("[eplugin::~p] already disabled.", [Plugin]) @@ -176,6 +177,7 @@ enable(Plugin) -> end, Callbacks) end, Modules), [register_callbacks(Plugin, M) || M <- Modules], + eplugin:apply('eplugin:enable_plugin', [Plugin]), ok end end.