We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
目前 unpkg 在国内的速度实在太慢了。而且官方网站提供的加载方式是阻塞模式的,遇到网络不好的时候会阻塞页面里其他脚本的加载,这个体验是非常不好的。(disqus使用了iframe方式避免了这个问题)。下面我的一个小建议:
window.VALINECONFIG = { el: '#comment', notify: false, verify: false }
<script src=".../Valine.min.js?config=VALINECONFIG" async></script>
附上一个我目前使用的解决方案:
function loadValine() { const config = window["VALINECONFIG"]; if (!config) return; const urls = [`//cdn1.lncld.net/static/js/3.0.4/av-min.js`,`//unpkg.com/valine/dist/Valine.min.js`]; const asyncloader = url => new Promise((resolve, reject) => { const script = document.createElement("script"); script.src = url; script.addEventListener("load", _ => resolve(), false); script.addEventListener("error", _ => reject(), false); document.body.appendChild(script); }); Promise.all(urls.map(asyncloader)) .then(() => new window["Valine"](config)) .catch(e => U.log("load Valine Failed,", e)); }
The text was updated successfully, but these errors were encountered:
我看你的解决方案中的${baseURL}是你网站本地的吧? 那既然下载下来了,为何还要用unpkg?
${baseURL}
unpkg
Sorry, something went wrong.
那我改成unpkg好了。。。。
No branches or pull requests
目前 unpkg 在国内的速度实在太慢了。而且官方网站提供的加载方式是阻塞模式的,遇到网络不好的时候会阻塞页面里其他脚本的加载,这个体验是非常不好的。(disqus使用了iframe方式避免了这个问题)。下面我的一个小建议:
附上一个我目前使用的解决方案:
The text was updated successfully, but these errors were encountered: