Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xxdk-wasm
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
xxdk-wasm
Merge requests
!67
fix for latest client release
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
fix for latest client release
release
into
master
Overview
1
Commits
277
Pipelines
0
Changes
3
Merged
Jake Taylor
requested to merge
release
into
master
2 years ago
Overview
1
Commits
277
Pipelines
0
Changes
3
Expand
0
0
Merge request reports
Viewing commit
037d3134
Show latest version
3 files
+
45
−
16
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
037d3134
Merge remote-tracking branch 'origin/release' into XX-4382/databaseInWorker2
· 037d3134
Jono Wenger
authored
2 years ago
storage/localStorage.go
+
14
−
4
Options
@@ -114,36 +114,46 @@ func (ls *LocalStorage) Clear() {
ls
.
clear
()
}
// ClearPrefix clears all keys with the given prefix.
func
(
ls
*
LocalStorage
)
ClearPrefix
(
prefix
string
)
{
// ClearPrefix clears all keys with the given prefix. Returns the number of
// keys cleared.
func
(
ls
*
LocalStorage
)
ClearPrefix
(
prefix
string
)
int
{
// Get a copy of all key names at once
keys
:=
ls
.
keys
()
// Loop through each key
var
n
int
for
i
:=
0
;
i
<
keys
.
Length
();
i
++
{
if
v
:=
keys
.
Index
(
i
);
!
v
.
IsNull
()
{
keyName
:=
strings
.
TrimPrefix
(
v
.
String
(),
ls
.
prefix
)
if
strings
.
HasPrefix
(
keyName
,
prefix
)
{
ls
.
removeItem
(
v
.
String
())
n
++
}
}
}
return
n
}
// ClearWASM clears all the keys in storage created by WASM.
func
(
ls
*
LocalStorage
)
ClearWASM
()
{
// ClearWASM clears all the keys in storage created by WASM. Returns the number
// of keys cleared.
func
(
ls
*
LocalStorage
)
ClearWASM
()
int
{
// Get a copy of all key names at once
keys
:=
ls
.
keys
()
// Loop through each key
var
n
int
for
i
:=
0
;
i
<
keys
.
Length
();
i
++
{
if
v
:=
keys
.
Index
(
i
);
!
v
.
IsNull
()
{
keyName
:=
v
.
String
()
if
strings
.
HasPrefix
(
keyName
,
ls
.
prefix
)
{
ls
.
RemoveItem
(
strings
.
TrimPrefix
(
keyName
,
ls
.
prefix
))
n
++
}
}
}
return
n
}
// Key returns the name of the nth key in localStorage. Return os.ErrNotExist if
Loading