Lavash.Lifecycle.OnMountImport (Lavash v0.4.0-rc.3)

Copy Markdown View Source

Re-exports Phoenix.LiveView.on_mount/1 so the macro is in scope inside use Lavash.LiveView modules without the user having to write import Phoenix.LiveView, only: [on_mount: 1].

This is a workaround for issue #20: Phoenix.LiveView's macros installed via __using__ don't propagate through Spark's handle_opts eval. Re-exporting via a thin module that Lavash's imports: list pulls in restores the macro to user module scope.

Once #20 is resolved (likely a Spark upstream fix), this module can be deleted.

Summary

Functions

Forwards to Phoenix.LiveView.on_mount/1. Declares an on_mount hook for the surrounding LiveView. The argument is a {Module, :tag} tuple or just a Module for the default tag.

Functions

on_mount(hook)

(macro)

Forwards to Phoenix.LiveView.on_mount/1. Declares an on_mount hook for the surrounding LiveView. The argument is a {Module, :tag} tuple or just a Module for the default tag.

See Phoenix.LiveView.on_mount/1 for full semantics.