Make disqus load a little bit sooner

This commit is contained in:
Rico Sta. Cruz 2017-10-26 14:48:24 +08:00
parent 0115bf5915
commit 60247db768
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
3 changed files with 7 additions and 8 deletions

View File

@ -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