aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-05-22 09:14:08 +0200
committerChocobozzz <me@florianbigard.com>2020-05-22 09:14:08 +0200
commita84e6eb11ce4f3db36fa34c2e223173e44a5eb50 (patch)
tree1607874331a1d817725825f9764799cbb269cce5 /client
parent745437e3ab402d5b8f85de6e9c09c3b6092e5904 (diff)
parentfd8f73cf6d2fa0073de0a7b50d1d9f4598fef9cf (diff)
downloadPeerTube-a84e6eb11ce4f3db36fa34c2e223173e44a5eb50.tar.gz
PeerTube-a84e6eb11ce4f3db36fa34c2e223173e44a5eb50.tar.zst
PeerTube-a84e6eb11ce4f3db36fa34c2e223173e44a5eb50.zip
Merge branch 'release/2.2.0' into develop
Diffstat (limited to 'client')
-rw-r--r--client/src/app/shared/misc/peertube-web-storage.ts42
1 files changed, 21 insertions, 21 deletions
diff --git a/client/src/app/shared/misc/peertube-web-storage.ts b/client/src/app/shared/misc/peertube-web-storage.ts
index 6a152dd98..0db1301bd 100644
--- a/client/src/app/shared/misc/peertube-web-storage.ts
+++ b/client/src/app/shared/misc/peertube-web-storage.ts
@@ -2,6 +2,27 @@
2 2
3const valuesMap = new Map() 3const valuesMap = new Map()
4 4
5function proxify (instance: MemoryStorage) {
6 return new Proxy(instance, {
7 set: function (obj, prop: string | number, value) {
8 if (MemoryStorage.prototype.hasOwnProperty(prop)) {
9 instance[prop] = value
10 } else {
11 instance.setItem(prop, value)
12 }
13 return true
14 },
15 get: function (target, name: string | number) {
16 if (MemoryStorage.prototype.hasOwnProperty(name)) {
17 return instance[name]
18 }
19 if (valuesMap.has(name)) {
20 return instance.getItem(name)
21 }
22 }
23 })
24}
25
5class MemoryStorage { 26class MemoryStorage {
6 [key: string]: any 27 [key: string]: any
7 [index: number]: string 28 [index: number]: string
@@ -50,27 +71,6 @@ try {
50 const instanceLocalStorage = new MemoryStorage() 71 const instanceLocalStorage = new MemoryStorage()
51 const instanceSessionStorage = new MemoryStorage() 72 const instanceSessionStorage = new MemoryStorage()
52 73
53 function proxify (instance: MemoryStorage) {
54 return new Proxy(instance, {
55 set: function (obj, prop: string | number, value) {
56 if (MemoryStorage.prototype.hasOwnProperty(prop)) {
57 instance[prop] = value
58 } else {
59 instance.setItem(prop, value)
60 }
61 return true
62 },
63 get: function (target, name: string | number) {
64 if (MemoryStorage.prototype.hasOwnProperty(name)) {
65 return instance[name]
66 }
67 if (valuesMap.has(name)) {
68 return instance.getItem(name)
69 }
70 }
71 })
72 }
73
74 peertubeLocalStorage = proxify(instanceLocalStorage) 74 peertubeLocalStorage = proxify(instanceLocalStorage)
75 peertubeSessionStorage = proxify(instanceSessionStorage) 75 peertubeSessionStorage = proxify(instanceSessionStorage)
76} 76}