Make the ID publicly readonly, privately writable
This commit is contained in:
parent
bfddf855a4
commit
228cc21de7
1 changed files with 7 additions and 3 deletions
|
|
@ -3,7 +3,11 @@ import { Logger } from "./Logger.mjs";
|
||||||
|
|
||||||
export class PopoverEventManager {
|
export class PopoverEventManager {
|
||||||
#options;
|
#options;
|
||||||
id;
|
#id;
|
||||||
|
|
||||||
|
get id() {
|
||||||
|
return this.#id;
|
||||||
|
};
|
||||||
|
|
||||||
/** @type {Map<string, PopoverEventManager>} */
|
/** @type {Map<string, PopoverEventManager>} */
|
||||||
static #existing = new Map();
|
static #existing = new Map();
|
||||||
|
|
@ -14,7 +18,7 @@ export class PopoverEventManager {
|
||||||
*/
|
*/
|
||||||
constructor(id, element, popoverClass, options = {}) {
|
constructor(id, element, popoverClass, options = {}) {
|
||||||
id = `${id}-${popoverClass.name}`;
|
id = `${id}-${popoverClass.name}`;
|
||||||
this.id = id;
|
this.#id = id;
|
||||||
|
|
||||||
if (PopoverEventManager.#existing.has(id)) {
|
if (PopoverEventManager.#existing.has(id)) {
|
||||||
const manager = PopoverEventManager.#existing.get(id);
|
const manager = PopoverEventManager.#existing.get(id);
|
||||||
|
|
@ -101,7 +105,7 @@ export class PopoverEventManager {
|
||||||
|
|
||||||
#construct(options) {
|
#construct(options) {
|
||||||
options.popover ??= {};
|
options.popover ??= {};
|
||||||
options.popover.managerId = this.id;
|
options.popover.managerId = this.#id;
|
||||||
|
|
||||||
return new this.#class(options);
|
return new this.#class(options);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue