@lightningjs/blits 1.29.4 → 1.29.5
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
package/package.json
CHANGED
|
@@ -66,13 +66,22 @@ export default {
|
|
|
66
66
|
value: function () {
|
|
67
67
|
this.eol = true
|
|
68
68
|
this.lifecycle.state = 'destroy'
|
|
69
|
+
|
|
70
|
+
for (let key in this[symbols.state]) {
|
|
71
|
+
if (Array.isArray(this[symbols.state][key])) {
|
|
72
|
+
this[symbols.state][key] = []
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
69
76
|
this.$clearTimeouts()
|
|
70
77
|
this.$clearIntervals()
|
|
71
78
|
eventListeners.removeListeners(this)
|
|
72
79
|
deleteChildren(this[symbols.children])
|
|
73
80
|
this[symbols.children].length = 0
|
|
74
81
|
removeGlobalEffects(this[symbols.effects])
|
|
82
|
+
|
|
75
83
|
this[symbols.state] = {}
|
|
84
|
+
|
|
76
85
|
this[symbols.props] = {}
|
|
77
86
|
this[symbols.computed] = null
|
|
78
87
|
this.lifecycle = {}
|
|
@@ -22,9 +22,10 @@ export default {
|
|
|
22
22
|
value: function (fn, ms, ...params) {
|
|
23
23
|
// early exit when component is marked as end of life
|
|
24
24
|
if (this.eol === true) return
|
|
25
|
+
|
|
25
26
|
const timeoutId = setTimeout(
|
|
26
27
|
() => {
|
|
27
|
-
this
|
|
28
|
+
this.$clearTimeout(timeoutId)
|
|
28
29
|
fn.apply(null, params)
|
|
29
30
|
},
|
|
30
31
|
ms,
|
|
@@ -39,8 +40,9 @@ export default {
|
|
|
39
40
|
},
|
|
40
41
|
$clearTimeout: {
|
|
41
42
|
value: function (timeoutId) {
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
const index = this[symbols.timeouts].indexOf(timeoutId)
|
|
44
|
+
if (index > -1) {
|
|
45
|
+
this[symbols.timeouts].splice(index, 1)
|
|
44
46
|
clearTimeout(timeoutId)
|
|
45
47
|
}
|
|
46
48
|
},
|
|
@@ -73,9 +75,10 @@ export default {
|
|
|
73
75
|
},
|
|
74
76
|
$clearInterval: {
|
|
75
77
|
value: function (intervalId) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
const index = this[symbols.intervals].indexOf(intervalId)
|
|
79
|
+
if (index > -1) {
|
|
80
|
+
this[symbols.intervals].splice(index, 1)
|
|
81
|
+
clearTimeout(intervalId)
|
|
79
82
|
}
|
|
80
83
|
},
|
|
81
84
|
writable: false,
|
package/src/component.js
CHANGED
|
@@ -298,7 +298,7 @@ const Component = (name = required('name'), config = required('config')) => {
|
|
|
298
298
|
|
|
299
299
|
// outOfViewport event emitting a lifecycle exit event
|
|
300
300
|
if (config.hooks.exit) {
|
|
301
|
-
this[symbols.wrapper].node.on('
|
|
301
|
+
this[symbols.wrapper].node.on('outOfBounds', () => {
|
|
302
302
|
this.lifecycle.state = 'exit'
|
|
303
303
|
})
|
|
304
304
|
}
|
package/src/component.test.js
CHANGED
|
@@ -322,8 +322,8 @@ test('Component - Instance should initialize hook events', (assert) => {
|
|
|
322
322
|
)
|
|
323
323
|
assert.equal(
|
|
324
324
|
nodeCalls[3].args[0],
|
|
325
|
-
'
|
|
326
|
-
'`
|
|
325
|
+
'outOfBounds',
|
|
326
|
+
'`outOfBounds` event should be registered in the wrapper'
|
|
327
327
|
)
|
|
328
328
|
assert.end()
|
|
329
329
|
})
|