【发布时间】:2020-10-14 11:40:55
【问题描述】:
我定义了一个在 Chrome Version 86.0.4240.80 (Official Build) (x86_64) 更新之前使用的属性访问器。
const newSetItem = (x, y) => {
sessionStorage.setItem(`custom_${x}`, y)
}
Object.defineProperty(localStorage, 'setItem', {get: newSetItem, configurable: true, writeable: true})
此外,这目前在 Firefox 和 Edge 以及 Chrome 85 中运行良好。
现在它抛出:
TypeError: Accessor properties are not allowed.
这是最新版 Chrome 的功能还是有问题?
【问题讨论】:
标签: javascript google-chrome accessor