@symbiotejs/symbiote 2.2.3 → 2.2.4

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/core/PubSub.js CHANGED
@@ -59,7 +59,7 @@ export class PubSub {
59
59
  if (!this.__computedMap) {
60
60
  /**
61
61
  * @private
62
- * @type {Object<string, *>}
62
+ * @type {Object<keyof T, *>}
63
63
  */
64
64
  this.__computedMap = {};
65
65
  }
@@ -138,10 +138,18 @@ export class PubSub {
138
138
  }
139
139
  }
140
140
 
141
- static #processComputed() {
141
+ /**
142
+ *
143
+ * @param {PubSub} instCtx
144
+ * @param {unknown} actProp
145
+ */
146
+ static #processComputed(instCtx, actProp) {
142
147
  this.globalStore.forEach((inst) => {
143
148
  if (inst.__computedMap) {
144
149
  Object.keys(inst.__computedMap).forEach((prop) => {
150
+ if ((inst === instCtx) && (actProp === prop)) {
151
+ return;
152
+ }
145
153
  let tName = `__${prop}_timeout`;
146
154
  if (inst[tName]) {
147
155
  window.clearTimeout(inst[tName]);
@@ -163,13 +171,15 @@ export class PubSub {
163
171
  // @ts-expect-error
164
172
  let isComputed = prop?.startsWith(DICT.COMPUTED_PX);
165
173
  if (this.callbackMap[prop]) {
166
- // @ts-expect-error
167
- let val = isComputed ? this.__computedMap[prop] : this.read(prop);
174
+ let val = this.read(prop);
168
175
  this.callbackMap[prop].forEach((callback) => {
169
176
  callback(val);
170
177
  });
178
+ if (isComputed) {
179
+ this.__computedMap[prop] = val;
180
+ }
171
181
  }
172
- !isComputed && PubSub.#processComputed();
182
+ !isComputed && PubSub.#processComputed(this, prop);
173
183
  }
174
184
 
175
185
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@symbiotejs/symbiote",
4
- "version": "2.2.3",
4
+ "version": "2.2.4",
5
5
  "description": "Symbiote.js - close-to-platform frontend library for building super-powered web components",
6
6
  "author": "symbiote.js@gmail.com",
7
7
  "license": "MIT",
@@ -1,6 +1,6 @@
1
1
  export class PubSub<T extends Record<string, unknown>> {
2
2
  static "__#1@#warn"(actionName: string, prop: any): void;
3
- static "__#1@#processComputed"(): void;
3
+ static "__#1@#processComputed"(instCtx: PubSub<any>, actProp: unknown): void;
4
4
  static registerCtx<S extends Record<string, unknown>>(schema: S, uid?: string | Symbol): PubSub<S>;
5
5
  static deleteCtx(uid: string | Symbol): void;
6
6
  static getCtx(uid: string | Symbol, notify?: boolean): PubSub<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"PubSub.d.ts","sourceRoot":"","sources":["../../core/PubSub.js"],"names":[],"mappings":"AAgBA;IAyBE,yDAEC;IAiGD,uCAkBC;IA6DD,uEAHW,SAAS,MAAM,aAczB;IAGD,sBADY,SAAS,MAAM,QAG1B;IAOD,mBAJW,SAAS,MAAM,iCAMzB;IA3ND,oBADY,CAAC,EAWZ;IARG,WAA6B;IAO/B,uCADoC,OAAO,KAAK,IAAI,GACd;IAYxC,WADY,MAAM,CAAC,OA6BlB;IAXK,sBAAuB;IAc7B,uBAEC;IAOD,uBAHW,OAAO,2BASjB;IAMD,UAHW,MAAM,CAAC,OACP,OAAO,QAkBjB;IAGD,eAcC;IAGD,iBADY,CAAC,QAKZ;IAuBD,aADY,MAAM,CAAC,QAYlB;IAOD,UAJW,MAAM,CAAC,kBACD,OAAO,KAAK,IAAI;;wBAAhB,OAAO,KAAK,IAAI;MAwBhC;IAKD,8BAEC;IAED,2BAEC;;CAkCF;;qBAEU,IAAI,SAAS,MAAM,cAAS"}
1
+ {"version":3,"file":"PubSub.d.ts","sourceRoot":"","sources":["../../core/PubSub.js"],"names":[],"mappings":"AAgBA;IAyBE,yDAEC;IAsGD,8DAFW,OAAO,QAuBjB;IA+DD,uEAHW,SAAS,MAAM,aAczB;IAGD,sBADY,SAAS,MAAM,QAG1B;IAOD,mBAJW,SAAS,MAAM,iCAMzB;IArOD,oBADY,CAAC,EAWZ;IARG,WAA6B;IAO/B,uCADoC,OAAO,KAAK,I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