Class StorageManager
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The StorageManager interface of the Storage API provides an interface for managing persistence permissions and estimating available storage. You can get a reference to this interface using either Navigator.Storage or WorkerNavigator.Storage.
[Value("StorageManager")]
public class StorageManager
- Inheritance
-
StorageManager
- Inherited Members
Remarks
Constructors
StorageManager()
public StorageManager()
Methods
Estimate()
The estimate() method of the StorageManager interface asks the Storage Manager for how much storage the current origin takes up (usage), and how much space is available (quota).
[Value("estimate")]
public Task<StorageEstimate> Estimate()
Returns
- Task<StorageEstimate>
A 'Promise' that resolves to an object with the following properties:
You may find that theNOTE
The returned values are not exact: between compression, deduplication, and obfuscation for security reasons, they will be imprecise.quotavaries from origin to origin. This variance is based on factors such as:
Remarks
This method operates asynchronously, so it returns a Promise which resolves once the information is available. The promise's fulfillment handler is called with an object containing the usage and quota data.
-Storage API
-Storage, the object returned by Window.LocalStorage
-StorageManager
-Navigator.Storage
GetDirectory()
The getDirectory() method of the StorageManager interface is used to obtain a reference to a FileSystemDirectoryHandle object allowing access to a directory and its contents, stored in the origin private file system (OPFS).
[Value("getDirectory")]
public Task<FileSystemDirectoryHandle> GetDirectory()
Returns
- Task<FileSystemDirectoryHandle>
A {{jsxref('Promise')}} that fulfills with a FileSystemDirectoryHandle object.
Remarks
-StorageManager
-Navigator.Storage
-WorkerNavigator.Storage
-FileSystemDirectoryHandle
Persist()
The persist() method of the StorageManager interface requests permission to use persistent storage, and returns a {{jsxref('Promise')}} that resolves to true if permission is granted and bucket mode is persistent, and false otherwise. The browser may or may not honor the request, depending on browser-specific rules. (For more details, see the guide to Storage quotas and eviction criteria.)
[Value("persist")]
public Task<bool> Persist()
Returns
Remarks
NOTE
This method is not available in Web Workers, though the StorageManager interface is.
Persisted()
The persisted() method of the StorageManager interface returns a {{jsxref('Promise')}} that resolves to true if your site's storage bucket is persistent.
[Value("persisted")]
public Task<bool> Persisted()