![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
retry-script
Advanced tools
retry-script
插件是一款能够使我们的项目、在加载js
静态资源失败的时候、进行重新尝试加载(或者换域名重新加载)
cdn
的方式引入<script src="http://xxx.xxx.xxx/retry-script.js"></script>
<script>
new RetryScript([
'http://local/1',
'http://local/2',
'http://local/3'
])
</script>
注意: 一定要在项目的最顶部引入
支持两种方式配置
1、仅配置hosts
时, 可以简化为
new RetryScript([
'http://local/1',
'http://local/2',
'http://local/3'
])
2、当多个配置时,看下面示例
new RetryScript({
hosts: [
'http://local/1',
'http://local/2',
'http://local/3'
],
handler (config) {
return config.join('http://www.xxx.cn', config.source)
}
})
名称 | 类型 | 默认值 | 必传 | 说明 |
---|---|---|---|---|
hosts | string[] | 无 | 是 | 重试的host 数组列表, 当js 加载失败时、默认会依次从hosts 数组中按照顺序取出对应的域名来尝试加载js |
handler | function | 无 | 否 | 处理函数, 接收**config 对象**, 返回值作为下次重试的src 地址; 如果返回值是字符串,则作为下次重试的src地址 ; 返回值如果是其他类型,则使用默认规则生成下次重试地址 |
config对象说明
名称 | 类型 | 说明 |
---|---|---|
currentIndex | number | 重试的hosts的index索引 |
source | string | 解析出来的资源名 |
oldSrc | string | 上一次加载失败的src路径 |
hosts | string[] | 传入的配置项hosts |
join | function | 路径拼接函数、用法同node 中path 模块的join 方法 |
方法名 | 返回值 | 示例 | 描述 |
---|---|---|---|
destory | 无 | captcha.destory() | 销毁控件 |
FAQs
重试script
We found that retry-script demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.