Skip to content

Commit

Permalink
added namespace.clear() feature (marcuswestin#300)
Browse files Browse the repository at this point in the history
  • Loading branch information
arhemd committed Dec 24, 2021
1 parent b8e22fe commit 7972077
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/store-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ var storeAPI = {
this.storage.clearAll()
},



// clear will remove all the stored key-value pairs in this namespace.
clear: function() {
let fn = (val, key) => {
if (key.startsWith(this._namespacePrefix)) {
this.storage.remove(key)
}
}
this.storage.each(fn)
},

// additional functionality that can't live in plugins
// ---------------------------------------------------

Expand Down

0 comments on commit 7972077

Please sign in to comment.