Drab v0.9.0 Release Notes
Release Date: 2018-06-29 // over 5 years ago-
๐ This release finally introduces the final API. There is no intention to change it, unless very
significant errors are found.๐ง If you are using Drab already, prepare for the changes in the configuration and also in the code.
Drab.Live
API changedAs described in #127, API has changed. The most painful change is
Drab.Live.peek
, as it now
returns{:ok, value}
or{:error, why}
. RaisingDrab.Live.peek
is for convinience.โก๏ธ
Drab.Live.poke
returns tuple now as well, to catch update errors or disconnections.Redesigned
Drab.Config
๐ง Since this version, Drab is no longer configured globally. This means that you may use it in the
multiple endpoints environments.
๐ง This requires configuration API change. Most of the Drab options are now located under
the endpoint module:config :drab, MyAppWeb.Endpoint, otp\_app: :my\_app\_web, ...
The endpoint and application name are mandatory.
However, there are still few global options, like
:enable_live_scripts
. Please read
๐Drab.Config
documentation
for more information.More API changes
โฑ All functions returning
{:timeout, description}
now return just{:error, :timeout}
.Undeclared handler or shared commander raises
All handlers must now be strictly declared by using
Drab.Commander.defhandler
or
Drab.Commander.public
macro.defhandler my\_handler(socket, payload), do: ..
or
public :my\_handlerdef my\_handler(socket, payload), do: ...
The same is with shared commanders, if you want to use it, declare it with
Drab.Controller
:use Drab.Controller, commanders: [My.Shared.Commander]
Hard depreciations of various functions
- Drab.Client.js/2
- Drab.run_handler()
- ๐ป Drab.Browser.console!/2
- ๐ป Drab.Browser.redirect_to!/2
- Drab.Core.broadcast_js!/2
drab-event
anddrab-handler
combination no longer exists๐ The existing syntax
drab-event
anddrab-handler
is removed. Please use the new syntax of:<tag drab="event:handler"> <input drab="focus:input_focus blur:input_blur" <input drab-focus="input_focus" drab-blur="input_blur">
โก๏ธ Updating from <= v0.8.3
config.exs
Replace:
config :drab, main\_phoenix\_app: :my\_app\_web, endpoint: MyAppWeb.Endpoint
with:
config :drab, MyAppWeb.Endpoint, otp\_app: :my\_app\_web
๐ง Most of the configuration options now must be placed under the endpoint. Please read
๐Drab.Config
documentation for more info.