@vacantthinker/firefox-addon-framework-easy 2026.603.1748 → 2026.603.1932
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/BaseORM.js +14 -8
package/package.json
CHANGED
package/src/BaseORM.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
stoOpCheck,
|
|
3
|
-
stoOpGet,
|
|
4
|
-
stoOpRem,
|
|
5
|
-
stoOpSet,
|
|
6
|
-
} from './opStorage.js';
|
|
1
|
+
import {stoOpCheck, stoOpGet, stoOpRem, stoOpSet} from './opStorage.js';
|
|
7
2
|
|
|
8
3
|
/**
|
|
9
4
|
* Abstract base class BaseORM (similar to Java's Abstract Class).
|
|
@@ -23,10 +18,11 @@ export class BaseORM {
|
|
|
23
18
|
constructor(prefix, id, defaultValue = {}) {
|
|
24
19
|
// Simulating Java's abstract class behavior: prevent direct instantiation of the base class
|
|
25
20
|
if (new.target === BaseORM) {
|
|
26
|
-
throw new TypeError(
|
|
21
|
+
throw new TypeError(
|
|
22
|
+
'Cannot construct BaseORM instances directly (Abstract Class).');
|
|
27
23
|
}
|
|
28
24
|
if (!prefix || !id) {
|
|
29
|
-
throw new Error(
|
|
25
|
+
throw new Error('Both prefix and id must be specified.');
|
|
30
26
|
}
|
|
31
27
|
|
|
32
28
|
// Automatically normalize the prefix format to ensure a clean trailing space
|
|
@@ -39,6 +35,16 @@ export class BaseORM {
|
|
|
39
35
|
this.#defaultValue = JSON.parse(JSON.stringify(defaultValue));
|
|
40
36
|
}
|
|
41
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Protected Getter for subclasses to safely access the complete key.
|
|
40
|
+
* Can be used in subclasses as `this.storageKey`.
|
|
41
|
+
* @protected
|
|
42
|
+
* @return {string} The full storage key
|
|
43
|
+
*/
|
|
44
|
+
get storageKey() {
|
|
45
|
+
return this.#fullStorageKey;
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
// Private helper method: checks if the bound key exists in the storage layer
|
|
43
49
|
async #exists() {
|
|
44
50
|
return await stoOpCheck(this.#fullStorageKey);
|