LOADING
导出的文件包含分类、主备地址标签及所有自定义配置与 CSS 代码,可用于备份或迁移。
跨设备文本、链接、代码极速流转
引入第三方开源库时使用,国内 npmmirror 50ms 极速,故障自动切 CF 优选代理:
ASSET_REGISTRY.myPlugin = {
type: 'js', // 或 'css'
id: 'asset-my-plugin',
primary: 'https://registry.npmmirror.com/包名/版本/files/dist/index.js',
fallback: 'https://cdn.jsdelivr.net/npm/包名@版本/dist/index.js',
isLoaded: function() { return typeof MyPlugin !== 'undefined'; }
};
0 秒等待,首屏立即下载运行(天气/打字机/每日一言等):
AssetLoader.load('myPlugin').then(function() {
MyPlugin.init();
});
不抢首屏带宽,3.5 秒后在浏览器空闲期静默缓存:
AssetLoader.preloadAll(['myPlugin'], 3500);
仅调用免费接口或直接操作 DOM 时,无需清单,直接写:
fetch('https://v1.hitokoto.cn/?encode=text')
.then(function(res) { return res.text(); })
.then(function(text) { console.log('一言:', text); });
{domain} 会自动替换为网站域名;{url} 会替换为完整编码网址。