Phoenix Live Favicon - Favicon manipulation for Phoenix Live

Update

v0.1.1
Yes, this is a bugfix release with a breaking change. I doubt remove_attr/3 was used (as nobody reported an issue)

- Breaking: `remove_attr/3` has been replaced by `remove_attr/2`
- Require Phoenix Live Head ~> 0.1.2

By using Phoenix Live Head 0.1.2 we can now safely use reset/1 (and reset_attr/2) in the on_mount hook to set the favicons to their default when navigating to another page. Thanks to @dfalling for leading me to the use case and subsequently the issue.

 alias Phx.Live.Favicon

 def on_mount(:default, _params, _session, socket) do
    {:cont, Favicon.reset(socket)}
 end

Now the order of events is preserved, the reset/1 and reset_attr/2 add an event to set the favicons to their initial values, but will dismiss any favicon events (for given attr in case of reset_attr/2) set before.

socket = 
  socket
|  > Favicon.set_class("green") <-- this event will never be send
[...]
socket = 
  socket
  |> Favicon.reset()
  |> Favicon.set_attr("href", "/images/fav/fav.png")