@lightningjs/blits 1.29.0 → 1.29.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ _28 may 2025_
4
+
5
+ ## v1.29.2
6
+
7
+ - Added end of life flag to prevent timers, intervals and listeners to be registered after component destroy
8
+
9
+ _22 may 2025_
10
+
11
+ ## v1.29.1
12
+
13
+ - Fixed issue with async and lifecycle ready error
14
+
15
+
3
16
  _22 may 2025_
4
17
 
5
18
  ## v1.29.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightningjs/blits",
3
- "version": "1.29.0",
3
+ "version": "1.29.2",
4
4
  "description": "Blits: The Lightning 3 App Development Framework",
5
5
  "bin": "bin/index.js",
6
6
  "exports": {
@@ -29,6 +29,8 @@ export default {
29
29
  },
30
30
  $listen: {
31
31
  value: function (event, callback, priority = 0) {
32
+ // early exit when component is marked as end of life
33
+ if (this.eol === true) return
32
34
  eventListeners.registerListener(this, event, callback, priority)
33
35
  },
34
36
  writable: false,
@@ -52,6 +52,7 @@ export default {
52
52
  },
53
53
  destroy: {
54
54
  value: function () {
55
+ this.eol = true
55
56
  this.lifecycle.state = 'destroy'
56
57
  this.$clearTimeouts()
57
58
  this.$clearIntervals()
@@ -62,7 +63,7 @@ export default {
62
63
  this[symbols.state] = {}
63
64
  this[symbols.props] = {}
64
65
  this[symbols.computed] = null
65
- this.lifecycle = null
66
+ this.lifecycle = {}
66
67
  this[symbols.effects].length = 0
67
68
  this.parent = null
68
69
  this.rootParent = null
@@ -71,7 +72,6 @@ export default {
71
72
  this[symbols.slots].length = 0
72
73
 
73
74
  delete this[symbols.computed]
74
- delete this.lifecycle
75
75
  delete this[symbols.effects]
76
76
  delete this.parent
77
77
  delete this.rootParent
@@ -20,6 +20,8 @@ import symbols from '../../lib/symbols.js'
20
20
  export default {
21
21
  $setTimeout: {
22
22
  value: function (fn, ms, ...params) {
23
+ // early exit when component is marked as end of life
24
+ if (this.eol === true) return
23
25
  const timeoutId = setTimeout(
24
26
  () => {
25
27
  this[symbols.timeouts] = this[symbols.timeouts].filter((id) => id !== timeoutId)
@@ -59,6 +61,8 @@ export default {
59
61
  },
60
62
  $setInterval: {
61
63
  value: function (fn, ms, ...params) {
64
+ // early exit when component is marked as end of life
65
+ if (this.eol === true) return
62
66
  const intervalId = setInterval(() => fn.apply(null, params), ms, params)
63
67
  this[symbols.intervals].push(intervalId)
64
68
  return intervalId