Make disqus load a little bit sooner
This commit is contained in:
parent
0115bf5915
commit
60247db768
|
@ -1,13 +1,12 @@
|
||||||
import onmount from 'onmount'
|
import onmount from 'onmount'
|
||||||
import injectDisqus from '../helpers/inject_disqus'
|
import injectDisqus from '../helpers/inject_disqus'
|
||||||
import ready from 'dom101/ready'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delay disqus by some time. It's at the bottom of the page, there's no need
|
* Delay disqus by some time. It's at the bottom of the page, there's no need
|
||||||
* for it to load fast. This will give more time to load more critical assets.
|
* for it to load fast. This will give more time to load more critical assets.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const DISQUS_DELAY = 10 * 1000
|
const DISQUS_DELAY = 100
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injects Disqus onto the page.
|
* Injects Disqus onto the page.
|
||||||
|
@ -24,7 +23,7 @@ onmount('[data-js-disqus]', function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disqus takes a while to load, don't do it so eagerly.
|
// Disqus takes a while to load, don't do it so eagerly.
|
||||||
ready(() => {
|
window.addEventListener('load', () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
injectDisqus(data.host)
|
injectDisqus(data.host)
|
||||||
$parent.removeAttribute('hidden')
|
$parent.removeAttribute('hidden')
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue