Last active
January 26, 2016 11:48
-
-
Save craigp/86ca552f1ec20c3d4404 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Room.Loader do | |
use GenEvent | |
require Logger | |
def start_link(_args) do | |
{:ok, pid} = GenEvent.start_link(name: :room_events) | |
GenEvent.add_handler(:room_events, __MODULE__, []) | |
{:ok, pid} | |
end | |
def init(_args) do | |
{:ok, %{}} | |
end | |
def handle_event({:load, file_name}, state) do | |
Logger.debug "Load #{file_name}" | |
{:ok, state} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment