move types to types file
This commit is contained in:
@@ -12,12 +12,12 @@
|
||||
audio_start_at,
|
||||
} from '$lib/context/audio-internals';
|
||||
import { user_preferences } from '$lib/context/user-preferences';
|
||||
import type { PlayerElement } from '$lib/types/types';
|
||||
import type { AudioPlayerElement } from '$lib/types';
|
||||
import { load_podcast_state } from '$lib/utility/use-state';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// readonly values
|
||||
let element: PlayerElement;
|
||||
let element: AudioPlayerElement;
|
||||
let current_time = $audio_start_at;
|
||||
let duration = 0;
|
||||
let ended = true;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { PlayerElement } from '$lib/types/types';
|
||||
import type { AudioPlayerElement } from '$lib/types';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
// readonly - stores will update when bindings change
|
||||
export const audio_current_time = writable<number>(0);
|
||||
export const audio_element = writable<PlayerElement>();
|
||||
export const audio_element = writable<AudioPlayerElement>();
|
||||
export const audio_duration = writable<number>(0);
|
||||
export const audio_ended = writable<boolean>(false);
|
||||
export const audio_loading = writable<boolean>(false);
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import type { AudioMetadata } from '$lib/types';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export type AudioMetadata = {
|
||||
title: string;
|
||||
artwork: string;
|
||||
};
|
||||
|
||||
export const audio_metadata = writable<AudioMetadata | null>(null);
|
||||
|
||||
@@ -10,9 +10,10 @@ import {
|
||||
audio_src,
|
||||
audio_start_at,
|
||||
} from '$lib/context/audio-internals';
|
||||
import { audio_metadata, type AudioMetadata } from '$lib/context/audio-metadata';
|
||||
import { audio_metadata } from '$lib/context/audio-metadata';
|
||||
import { episode_progress } from '$lib/context/episode-progress';
|
||||
import { user_preferences } from '$lib/context/user-preferences';
|
||||
import type { AudioLoadData, AudioLoadOptions } from '$lib/types';
|
||||
import { secondsToTimestamp } from '$lib/utility/seconds-to-timestamp';
|
||||
import { info, warn } from '$pkg/log';
|
||||
import clamp from 'just-clamp';
|
||||
@@ -105,13 +106,6 @@ function unmute(type: HandleType = 'set') {
|
||||
}
|
||||
}
|
||||
|
||||
export type AudioLoadData = AudioMetadata & { src: string };
|
||||
|
||||
export type AudioLoadOptions = {
|
||||
autoplay: boolean;
|
||||
start_at?: number;
|
||||
};
|
||||
|
||||
const load = (data: AudioLoadData, opts: AudioLoadOptions) => {
|
||||
episode_progress.stash();
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { browser } from '$app/environment';
|
||||
import { audio, type AudioLoadOptions } from '$lib/context/audio';
|
||||
import { audio } from '$lib/context/audio';
|
||||
import type { AudioLoadOptions, EpisodeProgress } from '$lib/types';
|
||||
import { error, info, warn } from '$lib/utility/package/log';
|
||||
|
||||
export type EpisodeProgress = {
|
||||
current_time: number;
|
||||
};
|
||||
|
||||
const episode_progress_map = new Map<string, EpisodeProgress>();
|
||||
|
||||
function stash_episode() {
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import { browser } from '$app/environment';
|
||||
import type { UserPreferences } from '$lib/types';
|
||||
import { info, warn } from '$lib/utility/package/log';
|
||||
import clamp from 'just-clamp';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
export type UserPreferences = {
|
||||
playback_rate: number;
|
||||
volume: number;
|
||||
};
|
||||
|
||||
const default_user_preferences = {
|
||||
playback_rate: 1,
|
||||
volume: 1,
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
export type AudioPlayerElement = HTMLAudioElement | undefined;
|
||||
|
||||
export interface AudioMetadata {
|
||||
title: string;
|
||||
artwork: string;
|
||||
}
|
||||
|
||||
export interface AudioLoadData extends AudioMetadata {
|
||||
src: string;
|
||||
}
|
||||
|
||||
export interface AudioLoadOptions {
|
||||
autoplay: boolean;
|
||||
start_at?: number;
|
||||
}
|
||||
|
||||
export interface EpisodeProgress {
|
||||
current_time: number;
|
||||
}
|
||||
|
||||
export interface UserPreferences {
|
||||
playback_rate: number;
|
||||
volume: number;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export type PlayerElement = HTMLAudioElement | undefined;
|
||||
Reference in New Issue
Block a user