https://github.com/expelledboy/plugerl
Most simple plugin system using Erlang behaviours.
https://github.com/expelledboy/plugerl
plugin-loader
Last synced: 9 months ago
JSON representation
Most simple plugin system using Erlang behaviours.
- Host: GitHub
- URL: https://github.com/expelledboy/plugerl
- Owner: expelledboy
- License: apache-2.0
- Created: 2017-08-23T16:03:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-23T16:11:56.000Z (over 8 years ago)
- Last Synced: 2025-03-24T10:12:16.366Z (9 months ago)
- Topics: plugin-loader
- Language: Erlang
- Size: 5.86 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Plugerl
=======
[](https://travis-ci.org/expelledboy/plugerl)
[](https://hex.pm/packages/plugerl)
[](https://hex.pm/packages/plugerl)
Most simple plugin system using Erlang behaviours.
### Usage
Module that uses plugins.
```erlang
-callback install(Config :: map()) -> ok | {error, atom()}.
main() ->
Config = project:config(),
plugerl:over(my_behaviour, with_my_behaviours(Config)),
loop().
loop() ->
receive Msg -> io:format("~p~n", [Msg]) end,
loop().
with_my_behaviours(Config) ->
fun(Plugin) ->
Plugin:install(Config)
end.
```
Plugin module.
```erlang
install(Config) ->
Timeout = maps:get(timeout, Config, 10),
timer:send_interval(Timeout, from_plugin).
```