@graphty/graphty-element / session / BrowserProjects
Interface: BrowserProjects ​
Defined in: graphty-element/src/session/browserProjects.ts:46
Projects kept in this browser's own storage, for a host with no file system to save to.
Methods ​
get() ​
get(
id):Promise<File|undefined>
Defined in: graphty-element/src/session/browserProjects.ts:72
A stored project as a file, named as a downloaded project is, ready for project.open.
Parameters ​
id ​
string
The stored project's id.
Returns ​
Promise<File | undefined>
The file, or undefined when no project has that id.
Throws ​
A GraphtyError (as a rejection) with E_UNSUPPORTED with no usable IndexedDB.
list() ​
list():
Promise<StoredProject[]>
Defined in: graphty-element/src/session/browserProjects.ts:53
The stored projects, newest first.
Returns ​
Promise<StoredProject[]>
Their ids, names, save times and sizes; never their contents.
Throws ​
A GraphtyError (as a rejection) with E_UNSUPPORTED when the browser has no IndexedDB or refuses to open it.
persisted() ​
persisted():
Promise<boolean>
Defined in: graphty-element/src/session/browserProjects.ts:85
Whether the browser has promised to keep this site's storage rather than clear it when it needs room or after a while without a visit. Never rejects.
Returns ​
Promise<boolean>
navigator.storage.persisted(), or false when the browser cannot say.
remove() ​
remove(
id):Promise<void>
Defined in: graphty-element/src/session/browserProjects.ts:79
Delete a stored project. Deleting an id that is not stored does nothing.
Parameters ​
id ​
string
The stored project's id.
Returns ​
Promise<void>
Settles once the delete has committed.
Throws ​
A GraphtyError (as a rejection) with E_UNSUPPORTED with no usable IndexedDB.
save() ​
save(
session,options?):Promise<StoredProject>
Defined in: graphty-element/src/session/browserProjects.ts:65
Save the whole session into browser storage, as project.save writes it. project.dirty clears only once the write has committed; a failed write leaves the project dirty. The first save asks the browser to keep its storage (navigator.storage.persist()).
Parameters ​
session ​
The session to save, such as element.session.
options? ​
The id of a stored project to replace.
Returns ​
Promise<StoredProject>
What was stored.
Throws ​
A GraphtyError (as a rejection): E_UNSUPPORTED with no usable IndexedDB, E_TOO_LARGE when the browser's storage quota is used up, and what project.save throws.