cradova 3.7.0 → 3.7.2

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/index.js CHANGED
@@ -218,7 +218,9 @@ var funcManager = {
218
218
  recall(func) {
219
219
  if (func.rendered) {
220
220
  if (func.published) {
221
- this.activate(func);
221
+ setTimeout(() => {
222
+ this.activate(func);
223
+ });
222
224
  }
223
225
  }
224
226
  },
@@ -306,10 +308,10 @@ var raw = (html) => {
306
308
  class cradovaEvent {
307
309
  after_comp_is_mounted = [];
308
310
  after_page_is_killed = [];
309
- async dispatchEvent(eventName) {
311
+ dispatchEvent(eventName) {
310
312
  const eventListeners = this[eventName];
311
313
  while (eventListeners.length !== 0) {
312
- const en_cb = await eventListeners.shift()();
314
+ const en_cb = eventListeners.shift()();
313
315
  if (en_cb) {
314
316
  this.after_page_is_killed.push(en_cb);
315
317
  }
@@ -349,9 +351,11 @@ class Signal {
349
351
  c.pipes.set(eventName, this.pipe[eventName]);
350
352
  funcManager.recall(c);
351
353
  }
352
- const subs2 = this.listening_subs[eventName] || [];
353
- for (const [el, fn] of subs2.entries()) {
354
- fn.apply(el, [{ [eventName]: data }]);
354
+ const subs2 = this.listening_subs[eventName];
355
+ if (subs2) {
356
+ for (const [el, fn] of subs2.entries()) {
357
+ fn.apply(el, [{ [eventName]: data }]);
358
+ }
355
359
  }
356
360
  if (this.pn) {
357
361
  localStorage.setItem(this.pn, JSON.stringify(this.pipe));
@@ -369,8 +373,10 @@ class Signal {
369
373
  s.add(c);
370
374
  }
371
375
  const subs2 = this.listening_subs[eventName];
372
- for (const [el, fn] of subs2.entries()) {
373
- s2.set(el, fn);
376
+ if (subs2) {
377
+ for (const [el, fn] of subs2.entries()) {
378
+ s2.set(el, fn);
379
+ }
374
380
  }
375
381
  }
376
382
  for (const c of s.values()) {
@@ -484,6 +490,7 @@ class Page {
484
490
  async _load() {
485
491
  if (this._name)
486
492
  document.title = this._name;
493
+ CradovaEvent.dispatchEvent("after_page_is_killed");
487
494
  this._template = div({ id: "page" }, this._html);
488
495
  RouterBox.doc.innerHTML = "";
489
496
  if (this._snapshot)
@@ -495,7 +502,6 @@ class Page {
495
502
  left: 0,
496
503
  behavior: "instant"
497
504
  });
498
- CradovaEvent.dispatchEvent("after_page_is_killed");
499
505
  if (this._snapshot)
500
506
  this._takeSnapShot();
501
507
  }
@@ -19,7 +19,7 @@ export declare class cradovaEvent {
19
19
  * Dispatch any event
20
20
  * @param eventName
21
21
  */
22
- dispatchEvent(eventName: "after_comp_is_mounted" | "after_page_is_killed"): Promise<void>;
22
+ dispatchEvent(eventName: "after_comp_is_mounted" | "after_page_is_killed"): void;
23
23
  }
24
24
  export declare const CradovaEvent: cradovaEvent;
25
25
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cradova",
3
- "version": "3.7.0",
3
+ "version": "3.7.2",
4
4
  "description": "Build Powerful ⚡ Web Apps with Ease",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",