Skip to content

Commit

Permalink
feat: avoid some edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
wqcstrong committed Jul 20, 2023
1 parent d10355a commit 84a44d5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/plugins/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,25 @@ export class StoragePlugin implements PageSpyPlugin {
Storage.prototype.clear = function () {
const action = 'clear';
const type = getStorageType(this);
clear.call(this);
sendStorageItem({ type, action });
return clear.call(this);
};
Storage.prototype.removeItem = function (name: string) {
const action = 'remove';
const type = getStorageType(this);
sendStorageItem({ type, action, name });
return removeItem.call(this, name);
removeItem.call(this, name);
sendStorageItem({ type, action, name: String(name) });
};
Storage.prototype.setItem = function (name: string, value: string) {
const action = 'set';
const type = getStorageType(this);
sendStorageItem({ type, action, name, value });
return setItem.call(this, name, value);
setItem.call(this, name, value);
sendStorageItem({
type,
action,
name: String(name),
value: String(value),
});
};
}

Expand Down

0 comments on commit 84a44d5

Please sign in to comment.