@tolgee/core 3.6.0 → 4.0.0
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/dist/tolgee.cjs.js +11 -1
- package/dist/tolgee.cjs.js.map +1 -1
- package/dist/tolgee.cjs.min.js +1 -1
- package/dist/tolgee.cjs.min.js.map +1 -1
- package/dist/tolgee.esm.js +1 -1
- package/dist/tolgee.esm.js.map +1 -1
- package/dist/tolgee.umd.js +11 -1
- package/dist/tolgee.umd.js.map +1 -1
- package/dist/tolgee.umd.min.js +1 -1
- package/dist/tolgee.umd.min.js.map +1 -1
- package/lib/Observer.d.ts +1 -0
- package/lib/Observer.js +10 -0
- package/lib/Observer.js.map +1 -1
- package/package.json +3 -3
package/lib/Observer.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare class Observer {
|
|
|
7
7
|
private nodeRegistrar;
|
|
8
8
|
constructor(properties: Properties, textWrapper: AbstractWrapper, nodeRegistrar: ElementRegistrar);
|
|
9
9
|
private _observer;
|
|
10
|
+
private _observing;
|
|
10
11
|
private get observer();
|
|
11
12
|
observe(): void;
|
|
12
13
|
stopObserving(): void;
|
package/lib/Observer.js
CHANGED
|
@@ -51,6 +51,7 @@ var Observer = /** @class */ (function () {
|
|
|
51
51
|
this.textWrapper = textWrapper;
|
|
52
52
|
this.nodeRegistrar = nodeRegistrar;
|
|
53
53
|
this._observer = undefined;
|
|
54
|
+
this._observing = false;
|
|
54
55
|
}
|
|
55
56
|
Object.defineProperty(Observer.prototype, "observer", {
|
|
56
57
|
get: function () {
|
|
@@ -68,6 +69,10 @@ var Observer = /** @class */ (function () {
|
|
|
68
69
|
case 1:
|
|
69
70
|
if (!!mutationsList_1_1.done) return [3 /*break*/, 8];
|
|
70
71
|
mutation = mutationsList_1_1.value;
|
|
72
|
+
if (!this._observing) {
|
|
73
|
+
// make sure we don't touch the DOM after disconnect is called
|
|
74
|
+
return [2 /*return*/];
|
|
75
|
+
}
|
|
71
76
|
if (!(mutation.type === 'characterData')) return [3 /*break*/, 3];
|
|
72
77
|
return [4 /*yield*/, this.textWrapper.handleText(mutation.target)];
|
|
73
78
|
case 2:
|
|
@@ -115,6 +120,10 @@ var Observer = /** @class */ (function () {
|
|
|
115
120
|
if (!this.observer) {
|
|
116
121
|
return;
|
|
117
122
|
}
|
|
123
|
+
if (this._observing) {
|
|
124
|
+
throw new Error('Tolgee: Observer is already running');
|
|
125
|
+
}
|
|
126
|
+
this._observing = true;
|
|
118
127
|
this.observer.observe(this.properties.config.targetElement, {
|
|
119
128
|
attributes: true,
|
|
120
129
|
childList: true,
|
|
@@ -126,6 +135,7 @@ var Observer = /** @class */ (function () {
|
|
|
126
135
|
if (!this.observer) {
|
|
127
136
|
return;
|
|
128
137
|
}
|
|
138
|
+
this._observing = false;
|
|
129
139
|
this.observer.disconnect();
|
|
130
140
|
};
|
|
131
141
|
return Observer;
|
package/lib/Observer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Observer.js","sourceRoot":"","sources":["../src/Observer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;IACE,kBACU,UAAsB,EACtB,WAA4B,EAC5B,aAA+B;QAF/B,eAAU,GAAV,UAAU,CAAY;QACtB,gBAAW,GAAX,WAAW,CAAiB;QAC5B,kBAAa,GAAb,aAAa,CAAkB;QAGjC,cAAS,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Observer.js","sourceRoot":"","sources":["../src/Observer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA;IACE,kBACU,UAAsB,EACtB,WAA4B,EAC5B,aAA+B;QAF/B,eAAU,GAAV,UAAU,CAAY;QACtB,gBAAW,GAAX,WAAW,CAAiB;QAC5B,kBAAa,GAAb,aAAa,CAAkB;QAGjC,cAAS,GAAG,SAAS,CAAC;QACtB,eA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,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,aAAa,EAAE;YAC1D,UAAU,EAAE,IAAI;YAChB,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;IACL,CAAC;IAEM,gCAAa,GAApB;QACE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO;SACR;QACD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC7B,CAAC;IACH,eAAC;AAAD,CAAC,AA/DD,IA+DC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tolgee/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Library providing ability to translate messages directly in context of developed application.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "./dist/tolgee.esm.js",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"tslib": "^2.3.1",
|
|
60
60
|
"typedoc": "0.22.12",
|
|
61
61
|
"typedoc-plugin-markdown": "3.11.14",
|
|
62
|
-
"typescript": "4.
|
|
62
|
+
"typescript": "4.6.2"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "3302234c530a50fd20a89ba62e84aa45b880a720",
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
}
|