@kizmann/pico-js 0.4.13 → 0.4.14

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": "@kizmann/pico-js",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
package/src/index.js CHANGED
@@ -85,14 +85,8 @@ if ( typeof global.pi === 'undefined' && global.navigator ) {
85
85
  global.pi = Pico;
86
86
  }
87
87
 
88
- global.pi.Dom.ready(function () {
89
-
90
- // Apply dom scroll event
91
- document.addEventListener("scroll",
92
- global.pi.Element.scroll);
93
-
94
- // Apply initial scroll event
95
- global.pi.Element.scroll();
96
- });
88
+ if ( typeof global.pi !== 'undefined' && global.document ) {
89
+ global.pi.Dom.ready(global.pi.Element.listen);
90
+ }
97
91
 
98
92
  export default Pico;
@@ -27,6 +27,15 @@ export class Element
27
27
  */
28
28
  static invi = [];
29
29
 
30
+ static listen()
31
+ {
32
+ // Apply dom scroll event
33
+ document.addEventListener("scroll", Element.scroll);
34
+
35
+ // Apply initial scroll event
36
+ Element.scroll();
37
+ }
38
+
30
39
  static scroll()
31
40
  {
32
41
  Arr.each(this.invi, (item, index) => {