mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
LocalSdrControls publishes the card to the radio store and SdrCard renders it. The new v-field-value directive never overwrites a focused field, including one a render disables.
30 lines
1008 B
JavaScript
30 lines
1008 B
JavaScript
import { defineStore } from 'pinia';
|
|
import { markRaw, shallowRef } from 'vue';
|
|
|
|
/**
|
|
* The Radio panel as its view renders it. RadioControls presents the
|
|
* directory row, station card, transport, volume and playback line
|
|
* (`renderRadioState()`) and publishes them here; it keeps its listeners,
|
|
* the tuner and the Cockpit radio controls. LocalSdrControls publishes the
|
|
* local RTL-SDR card beside it.
|
|
*/
|
|
export const useRadioStore = defineStore('gev-radio', () => {
|
|
/** The presented panel; null until the controls first render. */
|
|
const view = shallowRef(null);
|
|
|
|
/** @param {object} next A fresh presentation; every publish re-renders. */
|
|
function publish(next) {
|
|
view.value = markRaw(next);
|
|
}
|
|
|
|
/** The local RTL-SDR card; null until its controls first render. */
|
|
const sdr = shallowRef(null);
|
|
|
|
/** @param {object} next A fresh presentation of the RTL-SDR card. */
|
|
function publishSdr(next) {
|
|
sdr.value = markRaw(next);
|
|
}
|
|
|
|
return { view, publish, sdr, publishSdr };
|
|
});
|