/
StorageManager.cljs
54 lines (39 loc) · 1.77 KB
/
StorageManager.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
(ns web.storage.StorageManager
"The StorageManager interface of the the Storage API provides
interface for managing persistance permissions and estimating
storage. You can get a reference to this interface using either
or `WorkerNavigator.storage`."
(:refer-clojure :exclude []))
(defn estimate
"Method.
The estimate() method of the `web.storage.StorageManager` interface
the Storage Manager to obtain quota and usage information for
current origin. This method operates asynchronously, so it returns
`js.Promise` which resolves once the information is available.
promise's fulfillment handler receives as an input a `web.storage.StorageEstimate`
the usage and quota data.
`var estimatePromise = StorageManager.estimate();`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/StorageManager/estimate`"
[this ]
(-> this (.estimate)))
(defn persist
"Method.
[Experimental]
The persist() method of the `web.storage.StorageManager` interface
permission to use persistent storage, and returns a `js.Promise`
resolves to true if permission is granted and box mode is persistent,
false otherwise.
`navigator.storage.persist().then(function(persistent) { ... })`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/StorageManager/persist`"
[this & args]
(-> this .-persist (.apply this (clj->js args))))
(defn persisted
"Method.
[Experimental]
The persisted() method of the `web.storage.StorageManager` interface
a `js.Promise` that resolves to true if box mode is persistent
your site's storage.
`navigator.storage.persisted().then(function(persistent) { ... })`
See also: `https://developer.mozilla.org/en-US/docs/Web/API/StorageManager/persisted`"
[this & args]
(-> this .-persisted (.apply this (clj->js args))))