Update Docs Site (#44)

This commit is contained in:
Ollie Taylor
2023-07-11 22:13:18 +01:00
committed by GitHub
parent 3cb5e8eb46
commit 29ef65733e
80 changed files with 1624 additions and 2381 deletions
+8 -2
View File
@@ -17,7 +17,10 @@ const DEFAULT_USER_PREFERENCES = { playback_rate: 1, volume: 1 };
* The user preferences store
* @type {import('svelte/store').Writable<UserPreferences>}
*/
const USER_PREFERENCES_STORE = persisted('USER_PREFERENCE', DEFAULT_USER_PREFERENCES);
const USER_PREFERENCES_STORE = persisted(
'USER_PREFERENCE',
DEFAULT_USER_PREFERENCES,
);
/**
* Sets the playback rate for the user
@@ -26,7 +29,10 @@ const USER_PREFERENCES_STORE = persisted('USER_PREFERENCE', DEFAULT_USER_PREFERE
*/
const set_playback_rate = (value) => {
const playback_rate = clamp(value, 0.5, 5);
return USER_PREFERENCES_STORE.update((prefs) => ({ ...prefs, playback_rate }));
return USER_PREFERENCES_STORE.update((prefs) => ({
...prefs,
playback_rate,
}));
};
/**
+7 -3
View File
@@ -1,7 +1,7 @@
import { persisted } from 'svelte-local-storage-store';
import { get } from 'svelte/store';
import { episode_audio, episode_progress } from '../audio';
import { announce, use_url } from '../utility';
import { use_url, announce } from '../internal';
/**
* User progress object type.
@@ -34,7 +34,10 @@ const save_user_progress = () => {
const pathname = use_url(audio.src).pathname;
const current_time = get(episode_progress).current_time;
USER_PROGRESS_STORE.update((prev) => ({ ...prev, [pathname]: current_time }));
USER_PROGRESS_STORE.update((prev) => ({
...prev,
[pathname]: current_time,
}));
};
/**
@@ -59,7 +62,8 @@ const get_user_progress = (src) => {
* @function
* @returns {void}
*/
const clear_user_progress = () => USER_PROGRESS_STORE.set(DEFAULT_USER_PROGRESS);
const clear_user_progress = () =>
USER_PROGRESS_STORE.set(DEFAULT_USER_PROGRESS);
/**
* User progress object