unifi-client
Version:
NodeJs client for Unifi products (https://www.ui.com/)
38 lines (37 loc) • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObjectWithPrivateValues = void 0;
var _privateMap = new WeakMap();
var ObjectWithPrivateValues = /** @class */ (function () {
function ObjectWithPrivateValues() {
this.setPrivate('__init', true);
}
/**
* @typeParam T - the type retrieve.
* @param key - the key to retrieve
*/
ObjectWithPrivateValues.prototype.getPrivate = function (key) {
var privateDatas = this.privateMap.get(this);
return privateDatas[key];
};
/**
* @typeParam T - the type to set.
* @param key - the key to set
* @param value - the value
*/
ObjectWithPrivateValues.prototype.setPrivate = function (key, value) {
var privateDatas = this.privateMap.get(this) || {};
privateDatas[key] = value;
this.privateMap.set(this, privateDatas);
};
Object.defineProperty(ObjectWithPrivateValues.prototype, "privateMap", {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
get: function () {
return _privateMap;
},
enumerable: false,
configurable: true
});
return ObjectWithPrivateValues;
}());
exports.ObjectWithPrivateValues = ObjectWithPrivateValues;