您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
object with initialValue storing a weak reference to create private fields
当前为
此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/391608/744094/PrivateFieldAccessor.js
// ==UserScript== // @name PrivateFieldAccessor // @namespace hoehleg.userscripts.private // @version 0.1 // @description object with initialValue storing a weak reference to create private fields // @author Gerrit Höhle // @grant none // ==/UserScript== /* jshint esversion: 6 */ class PrivateProperty { constructor(initialValue) { this._privateData = new WeakMap(); this._initialValue = initialValue; } init(object, newInitialValue = this._initialValue) { this._initialValue = (typeof newInitialValue === "function") ? newInitialValue() : newInitialValue; this._privateData.set(object, this._initialValue); return this._initialValue; } hasValue(object) { return this._privateData.has(object); } get(object) { return this._privateData.get(object); } set(object, value) { this._privateData.set(object, value); } for(object) { return { init: PrivateProperty.prototype.init.bind(this, boundObject), hasValue: PrivateProperty.prototype.hasValue.bind(this, boundObject), get: PrivateProperty.prototype.get.bind(this, boundObject), set: PrivateProperty.prototype.set.bind(this, boundObject) }; } }