PhoenixKit.Install.JsIntegration (phoenix_kit v1.7.109)

Copy Markdown View Source

Handles automatic JavaScript hooks integration for PhoenixKit installation.

This module:

  • Copies phoenix_kit.js to the parent app's priv/static/assets/vendor/
  • Adds a <script> tag to the root layout so hooks are loaded before LiveSocket

The JS file defines window.PhoenixKitHooks which is spread into LiveSocket's hooks object in app.js: hooks: { ...window.PhoenixKitHooks, ...colocatedHooks }

Summary

Functions

Copies phoenix_kit.js to the parent app's static vendor directory and adds a script tag to the root layout.

Updates the JS file in the parent app's static vendor directory. Called during mix phoenix_kit.update to keep hooks in sync.

Functions

add_js_integration(igniter)

Copies phoenix_kit.js to the parent app's static vendor directory and adds a script tag to the root layout.

Safe to run multiple times (idempotent).

update_js_file()

Updates the JS file in the parent app's static vendor directory. Called during mix phoenix_kit.update to keep hooks in sync.