文心思匠

吸收那些用得着的东西,拒绝那些用不着的东西,增加那些自己所特有的东西

桃之夭夭,灼灼其华。之子于归,宜其室家。桃之夭夭,有蕡其实。之子于归,宜其家室。

前端实时通信,从轮询到流式通信SSE与WebSocket

引言:前端的实时通信 在前端开发中,实时通信已是基础能力。本文梳理轮询、WebSocket 与 SSE 的原理、适用场景,核心的是降低延迟、减少开销、提升可靠性。 技术选型速览 | 技术 | 方向 | 延迟 | 复杂度 | 适用场景 | | --------- | ---------- | ---- | ------ | ------------------------ | | 轮询 | 客户端拉取 | 高 | 低 | 简单更新,兼容性要求高 | | 长轮询 | 半双向 | 中 | 中 继续阅读

前端 package.json的使用, npm的生命周期

package.json本身没有生命周期,它是一个描述项目元信息和依赖关系的配置文件,但它参与了npm包的生命周期,即从包创建、发布、安装、运行到卸载的整个过程,通过定义scripts(如preinstall, install, postinstall, prepublish, publish, preuninstall, uninstall, postuninstall等),允许开发者在这些特定时刻执行自定义命令。npm 包生命周期主要阶段创建/开发阶段:prepack/pack: 打包前钩子.pack: 打包命令执行.prepublishOnly/prepublish: 发布前钩子,确保包 继续阅读

设置 Git 的 HTTP 代理(ClashX HTTP 端口默认 7890)

# 设置 Git 的 HTTP 代理(ClashX HTTP 端口默认 7890)git config --global http.proxy http://127.0.0.1:7890 git config --global https.proxy https://127.0.0.1:7890 继续阅读

flutter使用webview https证书过期不显示问题,忽略 SSL 错误

使用 flutter_inappwebview 插件,忽略 SSL 错误,用 onReceivedServerTrustAuthRequest 事件,并为指定请求或所有请求返回 ServerTrustAuthResponse(action: ServerTrustAuthResponseAction.PROCEED)。 child: InAppWebView(    initialUrlRequest: URLRequest(        url: Uri.parse("https://self-signed.badssl 继续阅读

Mac在终端快速使用WebStorm 编辑器

## 在终端快速使用 WebStorm 编辑器### 设置 WebStorm 别名快捷键1. 编辑 `.zshrc` 文件。  ```sh  vim .zshrc  ```2. 为 WebStorm 添加别名。  ```sh  alias webstorm='open -na "WebStorm.app" --args "$@"'  ```3. 使更改生效。  ```sh  source .zshrc  ```现在,你可以在终端中快速打开 WebStorm 并进入你的项目目录:```sh# 1. 进入项目 继续阅读

npm install certificate has expired 淘宝镜像证书过期的解决办法

npm config set registry https://registry.npm.taobao.org certificate has expired 原因: 新的Web 站点:https://npmmirror.com,Registry Endpoint:https://registry.npmmirror.com。随着新的域名已经正式启用,老 http://npm.taobao.org 和 http://registry.npm.taobao.org 域名将于 2022 年 05 月 31 日零时起停止服务淘宝 NPM 镜像站切换新域名 npm config s 继续阅读