Clear localStorage for a collection * @returns {undefined}
()
| 126 | * @returns {undefined} |
| 127 | */ |
| 128 | _clear() { |
| 129 | const local = this.localStorage(); |
| 130 | const itemRe = new RegExp(`^${this.name}-`); |
| 131 | |
| 132 | // Remove id-tracking item (e.g., "foo"). |
| 133 | local.removeItem(this.name); |
| 134 | |
| 135 | // Match all data items (e.g., "foo-ID") and remove. |
| 136 | for (let k in local) { |
| 137 | if (itemRe.test(k)) { |
| 138 | local.removeItem(k); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | this.records.length = 0; |
| 143 | } |
| 144 | |
| 145 | /** Number of items in localStorage |
| 146 | * @returns {integer} - Number of items |
nothing calls this directly
no test coverage detected