@linear_non/stellar-kit 2.1.8 → 2.1.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linear_non/stellar-kit",
3
- "version": "2.1.8",
3
+ "version": "2.1.10",
4
4
  "description": "Stellar frontend core for Non-Linear Studio projects.",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -22,7 +22,9 @@ export default class Observer extends Emitter {
22
22
  this.opts = merged
23
23
 
24
24
  const { trigger, start, end, scrub, once, markers } = this.opts
25
- const forward = type => self => this.emit(type, self, this)
25
+ const forward = type => self => {
26
+ return this.emit(type, self, this)
27
+ }
26
28
 
27
29
  this.st = ScrollTrigger.create({
28
30
  trigger,
@@ -46,13 +48,16 @@ export default class Observer extends Emitter {
46
48
  }
47
49
  }
48
50
 
49
- // allow ["enter","enterBack"]
51
+ // Array ["enter","enterBack"] OR String "enter"
50
52
  on(types, fn) {
51
- if (Array.isArray(types)) {
52
- types.forEach(t => super.on(t, fn))
53
- } else {
54
- super.on(types, fn)
53
+ const list = Array.isArray(types) ? types : [types]
54
+
55
+ list.forEach(t => super.on(t, fn))
56
+
57
+ if (this.st && this.st.isActive && list.includes("enter")) {
58
+ fn(this.st, this)
55
59
  }
60
+
56
61
  return this
57
62
  }
58
63