Skip to content

Commit

Permalink
depreciations
Browse files Browse the repository at this point in the history
  • Loading branch information
grych committed Jul 17, 2017
1 parent 3280bfa commit 382a7fe
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 69 deletions.
8 changes: 4 additions & 4 deletions lib/drab.ex
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,9 @@ defmodule Drab do
module.__drab__()
end

@doc false
def config() do
Drab.Config.config()
end
# @doc false
# def config() do
# Drab.Config.config()
# end

end
32 changes: 16 additions & 16 deletions lib/drab/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -155,21 +155,21 @@ defmodule Drab.Config do
def get(:browser_response_timeout), do: Application.get_env(:drab, :browser_response_timeout, 5000)
def get(_), do: nil

@doc """
Depreciated. Use `get/1` instead.
"""
def config() do
IO.warn """
`Drab.config` has been depreciated. Please use `Drab.Config.get/1` instead
"""
%{
templates_path: Application.get_env(:drab, :templates_path, "priv/templates/drab"),
disable_controls_while_processing: Application.get_env(:drab, :disable_controls_while_processing, true),
events_to_disable_while_processing: Application.get_env(:drab, :events_to_disable_while_processing, ["click"]),
disable_controls_when_disconnected: Application.get_env(:drab, :disable_controls_when_disconnected, true),
socket: Application.get_env(:drab, :socket, "/socket"),
drab_store_storage: Application.get_env(:drab, :drab_store_storage, :session_storage)
}
end
# @doc """
# Depreciated. Use `get/1` instead.
# """
# def config() do
# IO.warn """
# `Drab.config` has been depreciated. Please use `Drab.Config.get/1` instead
# """
# %{
# templates_path: Application.get_env(:drab, :templates_path, "priv/templates/drab"),
# disable_controls_while_processing: Application.get_env(:drab, :disable_controls_while_processing, true),
# events_to_disable_while_processing: Application.get_env(:drab, :events_to_disable_while_processing, ["click"]),
# disable_controls_when_disconnected: Application.get_env(:drab, :disable_controls_when_disconnected, true),
# socket: Application.get_env(:drab, :socket, "/socket"),
# drab_store_storage: Application.get_env(:drab, :drab_store_storage, :session_storage)
# }
# end

end
62 changes: 31 additions & 31 deletions lib/drab/core.ex
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ defmodule Drab.Core do
end
end

@doc false
def execjs(socket, js) do
Deppie.once("Drab.Core.execjs/2 is depreciated. Please use Drab.Core.exec_js/3 instead")
{_, result} = exec_js(socket, js)
result
end
# @doc false
# def execjs(socket, js) do
# Deppie.once("Drab.Core.execjs/2 is depreciated. Please use Drab.Core.exec_js/3 instead")
# {_, result} = exec_js(socket, js)
# result
# end

@doc """
Asynchronously broadcasts given javascript to all browsers listening on the given subject.
Expand Down Expand Up @@ -241,12 +241,12 @@ defmodule Drab.Core do
subject
end

@doc false
def broadcastjs(socket, js) do
Deppie.once("Drab.Core.broadcastjs/2 is depreciated. Please use Drab.Core.broadcast_js/3 instead")
broadcast_js(socket, js)
socket
end
# @doc false
# def broadcastjs(socket, js) do
# Deppie.once("Drab.Core.broadcastjs/2 is depreciated. Please use Drab.Core.broadcast_js/3 instead")
# broadcast_js(socket, js)
# socket
# end

@doc """
Helper for broadcasting functions, returns topic for a given URL path.
Expand All @@ -271,25 +271,25 @@ defmodule Drab.Core do
"""
def same_topic(topic), do: "topic:#{topic}"

@doc """
Moved to `Drab.Browser.console/2`
"""
def console(socket, log) do
Deppie.once """
Drab.Core.console/2 is depreciated. Use Drab.Browser.console/2 instead.
"""
Drab.Browser.console(socket, log)
end

@doc """
Moved to `Drab.Browser.console!/2`
"""
def console!(socket, log) do
Deppie.once """
Drab.Core.console!/2 is depreciated. Use Drab.Browser.console!/2 instead.
"""
Drab.Browser.console!(socket, log)
end
# @doc """
# Moved to `Drab.Browser.console/2`
# """
# def console(socket, log) do
# Deppie.once """
# Drab.Core.console/2 is depreciated. Use Drab.Browser.console/2 instead.
# """
# Drab.Browser.console(socket, log)
# end

# @doc """
# Moved to `Drab.Browser.console!/2`
# """
# def console!(socket, log) do
# Deppie.once """
# Drab.Core.console!/2 is depreciated. Use Drab.Browser.console!/2 instead.
# """
# Drab.Browser.console!(socket, log)
# end

@doc false
def encode_js(value), do: Poison.encode!(value)
Expand Down
28 changes: 14 additions & 14 deletions lib/drab/endpoint.ex
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
defmodule Drab.Endpoint do
@moduledoc ~S"""
Depreciated. To enable Drab, `use Drab.Socket` in your `UserSocket` module.
"""
# defmodule Drab.Endpoint do
# @moduledoc ~S"""
# Depreciated. To enable Drab, `use Drab.Socket` in your `UserSocket` module.
# """

defmacro __using__(_options) do
IO.warn """
Injecting Drab into Endpoint is depreciated, Drab.Endpoint will be removed.
To enable Drab, `use Drab.Socket` in your `UserSocket` module.
""", Macro.Env.stacktrace(__ENV__)
quote do
# socket Drab.config.socket, Drab.Socket
end
end
# defmacro __using__(_options) do
# IO.warn """
# Injecting Drab into Endpoint is depreciated, Drab.Endpoint will be removed.
# To enable Drab, `use Drab.Socket` in your `UserSocket` module.
# """, Macro.Env.stacktrace(__ENV__)
# quote do
# # socket Drab.config.socket, Drab.Socket
# end
# end

end
# end
8 changes: 4 additions & 4 deletions priv/templates/drab/drab.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@
}
this.channel.push("event", message)
},
launch_event: function(event_name, event_handler, payload, execute_after) {
console.log("WARNING: launch_event() is depreciated. Please use run_handler() instead.")
Drab.run_handler(event_name, event_handler, payload, execute_after)
},
// launch_event: function(event_name, event_handler, payload, execute_after) {
// console.log("WARNING: launch_event() is depreciated. Please use run_handler() instead.")
// Drab.run_handler(event_name, event_handler, payload, execute_after)
// },
connected: [],
disconnected: [],
load: [],
Expand Down

0 comments on commit 382a7fe

Please sign in to comment.