use crate::watch;
use default_struct_builder::DefaultBuilder;
use leptos::*;
use wasm_bindgen::JsCast;
/// Reactive favicon.
///
/// ## Demo
///
/// [Link to Demo](https://github.com/Synphonyte/leptos-use/tree/main/examples/use_favicon)
///
/// ## Usage
///
/// ```
/// # use leptos::*;
/// # use leptos_use::use_favicon;
/// #
/// # #[component]
/// # fn Demo(cx: Scope) -> impl IntoView {
/// #
/// let (icon, set_icon) = use_favicon(cx);
///
/// set_icon.set(Some("dark.png".to_string())); // change current icon
/// #
/// # view! { cx, }
/// # }
/// ```
///
/// ## Passing a Source Signal
///
/// You can pass a `Signal` to [`use_favicon_with_options`]. Change from the source signal will be
/// reflected in your favicon automatically.
///
/// ```
/// # use leptos::*;
/// # use leptos_use::{use_favicon_with_options, UseFaviconOptions, use_preferred_dark};
/// #
/// # #[component]
/// # fn Demo(cx: Scope) -> impl IntoView {
/// #
/// let is_dark = use_preferred_dark(cx);
///
/// let (icon, _) = use_favicon_with_options(
/// cx,
/// UseFaviconOptions::default().new_icon(
/// Signal::derive(cx, move || {
/// Some((if is_dark.get() { "dark.png" } else { "light.png" }).to_string())
/// }),
/// )
/// );
/// #
/// # view! { cx, }
/// # }
/// ```
///
pub fn use_favicon(cx: Scope) -> (ReadSignal