Skip to content

Instantly share code, notes, and snippets.

@craigp
Last active January 26, 2016 11:48
Show Gist options
  • Save craigp/86ca552f1ec20c3d4404 to your computer and use it in GitHub Desktop.
Save craigp/86ca552f1ec20c3d4404 to your computer and use it in GitHub Desktop.
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