随笔分类 -  [Whole Web]

摘要:HTTP1.1 假设你开了一家小卖部,但只有1个快递员帮你送货。这时候你会发现两个问题: 1️⃣ 队头阻塞问题:想象快递员每次只能拿一个快递,而且要严格按照顺序送。如果第一个快递是送到很远的山区(需要2小时),后面所有快递都要等这个山区快递送完才能出发。这时候就算后面的快递都是送到隔壁小区(只要5分 阅读全文
posted @ 2025-02-21 15:00 Zhentiw 阅读(2) 评论(0) 推荐(0) 编辑
摘要:同源策略及跨域问题 同源策略是一套浏览器安全机制,当一个源的文档和脚本,与另一个源的资源进行通信时,同源策略就会对这个通信做出不同程度的限制。 简单来说,同源策略对 同源资源 放行,对 异源资源 限制 因此限制造成的开发问题,称之为跨域(异源)问题 同源和异源 源(origin) = 协议 + 域名 阅读全文
posted @ 2025-02-11 03:50 Zhentiw 阅读(12) 评论(0) 推荐(0) 编辑
摘要:前面讲的都是在git提交之前的一些流程检查,而当我们git提交的时候,提交信息,也应该是需要规范的 commitlint 在使用Git提交代码时,通常都需要填写提交说明,也就是Commit Message git commit -m '提交测试' 说白了,Commit Message就是我们提交的时 阅读全文
posted @ 2025-02-10 00:02 Zhentiw 阅读(17) 评论(0) 推荐(0) 编辑
摘要:Git 流程规范配置 在前端项目开发中,规范git提交信息,也是经常使用的手段,如何确保团队成员都遵循ESint规则,且不会将不符合规范的代码推送到Git仓库? 答案是:使用带有git hooks功能的husky。git hooks是git内置的功能,它会在执行Git命令之前(或之后)进行一些其它操 阅读全文
posted @ 2025-02-09 23:47 Zhentiw 阅读(10) 评论(0) 推荐(0) 编辑
摘要:代码格式化配置(Prettier) 1、安装插件 2、下载 prettier 相关依赖 pnpm add prettier -D 3、配置 Prettier(.prettierrc.cjs) prettier会默认优先读取项目中的 // @see: https://www.prettier.cn m 阅读全文
posted @ 2025-02-09 23:44 Zhentiw 阅读(20) 评论(0) 推荐(0) 编辑
摘要:项目风格统一 在前端项目中存在.vscode文件夹,文件夹下一般存在两个文件extensions.json和setting.json。作用是保持所有开发者安装了相同的插件和相同的配置,保持开发环境一致性。 extensions.json 在当前项目中,需要安装哪些插件。 { "recommendat 阅读全文
posted @ 2025-02-09 23:38 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:HTTP的消息格式是一种纯文本的格式,文本分为三个部分: 请求行 请求头 请求体 具体每一部分写什么内容,要看具体的服务要求 试一试 有非常多的工具可以发送http请求,这里推荐一个非常直观的工具 安装vscode插件REST Clinet 新建文件xxx.http 编写请求文本 POST /api 阅读全文
posted @ 2025-02-06 02:01 Zhentiw 阅读(7) 评论(0) 推荐(0) 编辑
摘要:本小节我们先来介绍一下在设计开源库的时候有哪些原则以及最佳实践。 函数的设计 函数包含三要素: 函数名 参数 返回值 函数名 函数通常表示做一件事情,因此函数名一般为一个动词或者表示动作的短语,我们希望通过函数名就能够传达这个函数是做什么的。哪怕整个函数单词用得多一些,整个函数名长一些也无所谓,只要 阅读全文
posted @ 2025-01-30 11:26 Zhentiw 阅读(1) 评论(0) 推荐(0) 编辑
摘要:Bun 课堂笔记 对比 Node.js Bun 语言 C++ Zig JS 引擎 V8 JSCore Zig:https://ziglang.org/ 关于 V8 和 JSCore 各自有不同的架构和优化策略: JSC 优先考虑的是更快的启动时间和更少的内存占用,执行时间会稍微久一下 V8 优先考虑 阅读全文
posted @ 2024-11-24 16:20 Zhentiw 阅读(55) 评论(0) 推荐(0) 编辑
摘要:When users try to visit our application, example.comfor the first time, DNS need to parsing and find out application IP address. After first time visi 阅读全文
posted @ 2024-11-18 15:55 Zhentiw 阅读(6) 评论(0) 推荐(0) 编辑
摘要:Let's say we have a Vue application that renders many heavy components on the first load. The problem we're facing is a long white screen period while 阅读全文
posted @ 2024-09-15 20:49 Zhentiw 阅读(5) 评论(0) 推荐(0) 编辑
摘要:In a production environment, we want to prompt the user with a message when new scripts are available, asking New scripts are available. Do you want t 阅读全文
posted @ 2024-09-15 20:24 Zhentiw 阅读(6) 评论(0) 推荐(0) 编辑
摘要:The basic interpolatefunction we can create: function interpolate(str, params) { let names = Object.keys(params); // ["title", "description"] let valu 阅读全文
posted @ 2024-08-20 14:49 Zhentiw 阅读(11) 评论(0) 推荐(0) 编辑
摘要:Let's say we have a web component: import { getProductById } from "../services/Menu.js"; import { addToCart } from "../services/Order.js"; export defa 阅读全文
posted @ 2024-08-20 14:23 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:// memento.js import { TodoList } from "./classes.js"; export const TodoHistory = { history: [], push(state) { if (state) { // always push a new Set t 阅读全文
posted @ 2024-08-19 14:45 Zhentiw 阅读(5) 评论(0) 推荐(0) 编辑
摘要:Refer to: https://stately.ai/docs/actor-model What defines an “actor”?​ Actors are independent “live” objects that can communicate with each other via 阅读全文
posted @ 2024-08-14 15:07 Zhentiw 阅读(10) 评论(0) 推荐(0) 编辑
摘要:Problem to Solve Reparesent a value that is immutable and distinct from other objects based on its properties rather than its identity. Solution Creat 阅读全文
posted @ 2024-08-14 14:52 Zhentiw 阅读(1) 评论(0) 推荐(0) 编辑
摘要:Problem to Solve Share functionality between classes without using inheritance. Solution Create a class containing methods that can be used by other c 阅读全文
posted @ 2024-08-14 14:48 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:A memory pool, also known as a memory buffer pool, is a method used in software development for managing memory allocation. Instead of allocating and 阅读全文
posted @ 2024-02-05 16:00 Zhentiw 阅读(10) 评论(0) 推荐(0) 编辑
摘要:Refer to post: http://shebang.mintern.net/foolproof-html-escaping-in-javascript/ Code: var ESC_MAP = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '& 阅读全文
posted @ 2023-11-23 15:41 Zhentiw 阅读(10) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示