izi_lightup 1.0.8 → 1.0.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e07a49f206c6fb345cf0b7bbc5fbc2b97c7eb7ebe6d0a67b40249c0efcb8d3cb
4
- data.tar.gz: c14d54784f732666060f993b8f3dd2c344e9c3cbf4247e836d9a7a92e395b1a0
3
+ metadata.gz: 42f8d61f9ec4c7084a86d25b94406a90f50e143f8321019baa55c371c99f9954
4
+ data.tar.gz: 1b69afac25575f41dc28f2b58f738e72da421324a9686d4741f1780a10684110
5
5
  SHA512:
6
- metadata.gz: 45f511555379a877ce6da9caaea827e5fecb924e63ab2ab1410860fdcd484089fe4ca01fd3fe744b2a65691aca3190c0c795a8e8d96eaf9f326f4aa8263086cb
7
- data.tar.gz: 7de673a26083b07cb3c8ad2828c6b6118930aaf71a0baa4e33cc7c0dd4fb57e017c572199b3f9ec8503e84e08f79f8017d1c12a475518c2dea86421083603476
6
+ metadata.gz: eaa3f189c8f6dbe98b57d46b24a445f5be051a96eab836de9665b5d6984422de4f3915fe482100d198bac3290ec7049c214d64946964784314efcf8e8b239d0c
7
+ data.tar.gz: d15c0663e94f3daa8059c5cfb25f2eaa98874c3d36f65608ab2d542649c7d32ae3ac060bcc56e210e94c4a2b0f5da9a6672ce309f7c20e5b25f08b3553b3bcde
@@ -1,6 +1,6 @@
1
1
  ((window, document) -> (
2
2
  EVENT_TYPE = window.__activeEventName || 'Activity'
3
- MAX_TIMEOUT = window.__activeTimeout || 5000
3
+ MAX_TIMEOUT = window.__activeTimeout || 10000
4
4
  TRACK_MARKING = window.__activeMark || '_real_track=true'
5
5
 
6
6
  if custom_mt = /^\?(\d+)$/.exec(window.location.search)
@@ -55,4 +55,29 @@
55
55
 
56
56
  document.body.appendChild(src)
57
57
  true
58
+
59
+ window.miniPreload ||= (key, source_url, callback = undefined) ->
60
+ id = "source_#{key.replace(/[^a-z0-9_\-]+/ig, '_')}"
61
+ __required[id] ||= {loaded: false, callbacks: [], started: false}
62
+
63
+ # subscribe only if no source
64
+ return _subscribe(id, callback) unless source_url?.length > 0
65
+
66
+ # subscribe only if already attached & started
67
+ return _subscribe(id, callback) if __required[id].started
68
+
69
+ # mark as started
70
+ __required[id].started = true
71
+
72
+ # attach script
73
+ src = document.createElement('link')
74
+ src.id = id
75
+ src.rel = 'preload'
76
+ src.href = source_url
77
+ _buildSubscriptions(id, src)
78
+ _subscribe(id, callback)
79
+
80
+ document.head.appendChild(src)
81
+ true
82
+
58
83
  ))(window, document)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IziLightup
4
- VERSION = '1.0.8'
4
+ VERSION = '1.0.9'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: izi_lightup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - IzikAJ
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-09 00:00:00.000000000 Z
11
+ date: 2020-12-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Utils to speed up page load by using critical css &