KinoPhoenixLiveView.Iframe (kino_phoenix_live_view v0.1.2)

Provides a Kino JavaScript widget that embeds a Phoenix LiveView endpoint inside an iframe. This module leverages Kino.JS to render an iframe in the notebook.

The associated JavaScript asset (main.js) creates an <iframe> element with the provided source URL and appends it to the widget's root.

Summary

Functions

Creates a new Kino JavaScript widget with the given iframe source.

Starts the iframe widget using the given endpoint.

Functions

new(list)

Creates a new Kino JavaScript widget with the given iframe source.

This function initializes the widget by calling Kino.JS.new/2 with the current module and the specified src.

Parameters

  • src: A keyword with the key :src containing the URL to load in the iframe.

Examples

iex> KinoPhoenixLiveView.Iframe.new(src: "http://localhost:4000/")

start(list)

Starts the iframe widget using the given endpoint.

It extracts the iframe source URL by calling the endpoint's :path function with "/" and delegates to new/1.

Parameters

  • endpoint: The Phoenix endpoint module used to generate the URL.

Examples

iex> KinoPhoenixLiveView.Iframe.start(endpoint: MyApp.Endpoint)