Skip to content

Commit

Permalink
TODO Clear
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Jan 17, 2024
1 parent dcd45be commit dc13900
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cmds/mcla_wasm/errdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ func NewJsStorageCache(storage js.Value, prefix string) *JsStorageCache {
}
}

// TODO
func (s *JsStorageCache) Clear() {
leng := s.storage.Get("length").Int()
for i := 0; i < leng; i++ {
key := s.storage.Call("key", i).String()
if strings.HasPrefix(key, s.prefix) {
s.storage.Call("removeItem", key)
}
}
// leng := s.storage.Get("length").Int()
// for i := 0; i < leng; i++ {
// key := s.storage.Call("key", i).String()
// if strings.HasPrefix(key, s.prefix) {
// s.storage.Call("removeItem", key)
// }
// }
}

func (s *JsStorageCache) Get(key string) string {
Expand Down

0 comments on commit dc13900

Please sign in to comment.