MCPcopy Create free account
hub / github.com/Moosync/Moosync / initialize

Method initialize

src/players/librespot.rs:183–204  ·  view source on GitHub ↗
(&self, _: NodeRef<leptos::html::Div>)

Source from the content-addressed store, hash-verified

181impl GenericPlayer for LibrespotPlayer {
182 #[tracing::instrument(level = "debug", skip(self))]
183 fn initialize(&self, _: NodeRef<leptos::html::Div>) {
184 spawn_local(async move {
185 let data = load_selective("spotify.enable".into()).await;
186
187 let enabled: Vec<CheckboxPreference> = if let Ok(data) = data {
188 serde_wasm_bindgen::from_value(data).unwrap_or(vec![CheckboxPreference {
189 key: "enable".into(),
190 enabled: true,
191 }])
192 } else {
193 vec![CheckboxPreference {
194 key: "enable".into(),
195 enabled: true,
196 }]
197 };
198 for pref in enabled {
199 if pref.key == "enable" {
200 LibrespotPlayer::set_enabled(pref.enabled)
201 }
202 }
203 });
204 }
205
206 #[tracing::instrument(level = "debug", skip(self))]
207 fn key(&self) -> String {

Callers

nothing calls this directly

Calls 1

load_selectiveFunction · 0.85

Tested by

no test coverage detected