Merge branch 'main' into experiment/editContext
This commit is contained in:
commit
603719de38
8 changed files with 350 additions and 32 deletions
32
src/routes/(editor)/experimental/file-system-observer.tsx
Normal file
32
src/routes/(editor)/experimental/file-system-observer.tsx
Normal file
|
@ -0,0 +1,32 @@
|
|||
import { createEffect, createSignal, on } from "solid-js";
|
||||
import { readFiles } from "~/features/file";
|
||||
import { contentsOf } from "~/features/file/helpers";
|
||||
|
||||
export default function FileObserver(props: {}) {
|
||||
const [dir, setDir] = createSignal<FileSystemDirectoryHandle>();
|
||||
|
||||
const files = readFiles(dir);
|
||||
const contents = contentsOf(dir);
|
||||
|
||||
const open = async () => {
|
||||
const handle = await window.showDirectoryPicker();
|
||||
|
||||
setDir(handle)
|
||||
};
|
||||
|
||||
createEffect(() => {
|
||||
console.log('dir', dir());
|
||||
});
|
||||
|
||||
createEffect(() => {
|
||||
console.log('files', files());
|
||||
});
|
||||
|
||||
createEffect(() => {
|
||||
console.log('contents', contents());
|
||||
});
|
||||
|
||||
return <div>
|
||||
<button onclick={open}>Select folder</button>
|
||||
</div>;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue