Rename Navigator to FSNAvigator to avoid conflicts

This commit is contained in:
2024-08-30 15:35:53 +02:00
parent 740dee033a
commit 2c0d7d81ac
4 changed files with 10 additions and 10 deletions

View File

@@ -2,7 +2,7 @@ import { fs_get_node, FSNode, FSPath, FSPermissions } from "./FilesystemAPI";
import { fs_encode_path, fs_split_path } from "./FilesystemUtil"; import { fs_encode_path, fs_split_path } from "./FilesystemUtil";
import { Writable } from "svelte/store" import { Writable } from "svelte/store"
export class Navigator { export class FSNavigator {
// Parts of the raw API response // Parts of the raw API response
path: Array<FSNode> = [] path: Array<FSNode> = []
base_index: number = 0 base_index: number = 0
@@ -44,11 +44,11 @@ export class Navigator {
} }
} }
// The Navigator acts as a svelte store. This allows for DOM reactivity. // The FSNavigator acts as a svelte store. This allows for DOM reactivity.
// This works by implementing the store contract: // This works by implementing the store contract:
// https://svelte.dev/docs/svelte-components#script-4-prefix-stores-with-$-to-access-their-values // https://svelte.dev/docs/svelte-components#script-4-prefix-stores-with-$-to-access-their-values
subscribers: Array<(nav: Navigator) => void> = [] subscribers: Array<(nav: FSNavigator) => void> = []
subscribe(sub_func: (nav: Navigator) => void) { subscribe(sub_func: (nav: FSNavigator) => void) {
// Immediately return the current value // Immediately return the current value
sub_func(this) sub_func(this)

View File

@@ -11,7 +11,7 @@ import UploadWidget from './upload_widget/UploadWidget.svelte';
import { fs_path_url } from './FilesystemUtil'; import { fs_path_url } from './FilesystemUtil';
import { branding_from_path } from './edit_window/Branding.js' import { branding_from_path } from './edit_window/Branding.js'
import Menu from './Menu.svelte'; import Menu from './Menu.svelte';
import { Navigator } from "./Navigator" import { FSNavigator } from "./FSNavigator"
import { writable } from 'svelte/store'; import { writable } from 'svelte/store';
let file_viewer let file_viewer
@@ -25,7 +25,7 @@ let edit_visible = false
let view = "file" let view = "file"
const loading = writable(true) const loading = writable(true)
const nav = new Navigator(true) const nav = new FSNavigator(true)
onMount(() => { onMount(() => {
nav.loading = loading nav.loading = loading

View File

@@ -5,9 +5,9 @@ import GalleryView from './GalleryView.svelte'
import Modal from '../../util/Modal.svelte'; import Modal from '../../util/Modal.svelte';
import LoadingIndicator from '../../util/LoadingIndicator.svelte'; import LoadingIndicator from '../../util/LoadingIndicator.svelte';
import Breadcrumbs from '../Breadcrumbs.svelte' import Breadcrumbs from '../Breadcrumbs.svelte'
import { Navigator } from '../Navigator'; import { FSNavigator } from '../FSNavigator';
let nav = new Navigator(false) let nav = new FSNavigator(false)
let modal let modal
let dispatch = createEventDispatcher() let dispatch = createEventDispatcher()
let directory_view = "" let directory_view = ""

View File

@@ -1,9 +1,9 @@
<script> <script>
import { onMount } from "svelte"; import { onMount } from "svelte";
import { Navigator } from "../../filesystem/Navigator" import { FSNavigator } from "../../filesystem/FSNavigator"
import { fs_encode_path, fs_node_icon } from "../../filesystem/FilesystemUtil"; import { fs_encode_path, fs_node_icon } from "../../filesystem/FilesystemUtil";
const nav = new Navigator(false) const nav = new FSNavigator(false)
onMount(() => { onMount(() => {
nav.navigate("/me", false) nav.navigate("/me", false)
}) })