Drab v0.9.0 Release Notes

Release Date: 2018-06-29 // over 4 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 changed

    As described in #127, API has changed. The most painful change is Drab.Live.peek, as it now
    returns {:ok, value} or {:error, why}. Raising Drab.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.

    Do You Want to Know More?

    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 and drab-handler combination no longer exists

    ๐Ÿšš The existing syntax drab-event and drab-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">
    

    Do You Want to Know More?

    โšก๏ธ 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.