Skip to content

Commit 7d64671

Browse files
committed
1
1 parent 73328c7 commit 7d64671

13 files changed

+148
-23
lines changed

1.md

-16
This file was deleted.

JS/js执行常识.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# JS执行的一些基本规则
2+
3+
## 一行语句中,从左到右执行
4+
```js
5+
const a = (arg) => {
6+
console.log('arg-', arg);
7+
return arg + 1;
8+
}
9+
10+
const b = a(1) + a(2)
11+
console.log('b-', b)
12+
// arg-1
13+
// arg-2
14+
// 5
15+
```
16+
17+
## eslint: require-atomic-updates 由于await和yield异步导致可能存在的竞态条件
18+
19+
```js
20+
// 错误代码示范
21+
let result = 0;
22+
result += await doSomething();
23+
// 等同于:
24+
result = result + await doSomething();
25+
26+
// 正确代码1:先异步,后同步
27+
result = await doSomething() + result;
28+
// 正确示范2:一直使用const,不使用let
29+
```
30+
31+
- 原因:语句先读取了`result`的值,然后执行异步方法`doSomething`。在异步执行过程中,result的值可能已经更新了。
32+
此时我们使用了缓存的未更新前的`result`,导致更新丢失
33+
- 解决办法1:在异步完成之后,再去读取本地的值
34+
- 解决办法2:避免使用let

JS/ es细节问题.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## 对象结构语法赋予默认值时,null视为有值,不会被赋予默认值
2+
3+
```js
4+
const obj = { a: 'a',b:undefined,c:null}
5+
const { a = 1,b=1,c=1,d=1} = obj
6+
console.log(a) // 字符串a; a有值,不会被赋予默认值
7+
console.log(b) // 1; undefined会被赋予默认值
8+
console.log(c) // null; null不会被赋予默认值
9+
console.log(d) // 1; d未定义,等于undefined会被赋予默认值
10+
```
11+
12+
解答:es6文档上有明确说明
13+
14+
对象的解构也可以指定默认值。默认值生效的条件是,对象的属性值严格等于undefined。
15+
16+
```js
17+
var {x = 3} = {x: undefined};
18+
x // 3
19+
20+
var {x = 3} = {x: null};
21+
x // null
22+
```
23+
上面代码中,属性x等于null,因为null与undefined不严格相等,所以是个有效的赋值,导致默认值3不会生效。

networkRequest/XMLHttpRequest.md

-7
This file was deleted.
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## axios在nodejs中的使用
2+
3+
## 发送请求体的数据类型
4+
const res = await axios.post('https://httpbin.org/post', { hello: 'world' });
5+
6+
res.data.json; // { hello: 'world' }
7+
When sending requests with data, the data can be of type:
8+
9+
- string
10+
- object
11+
- ArrayBuffer
12+
- ArrayBufferView
13+
- URLSearchParams
14+
- Form Data:browser only.
15+
- File: browser only.
16+
- Blob: browser only.
17+
- Stream:Node only
18+
- Buffer:Node only
19+
20+
Note: Stream and Buffer is for Node only while Form Data, File, and Blob is for the browser only.
21+
22+
## responseType: 返回数据类型
23+
服务端响应的数据类型
24+
25+
选项包括:
26+
- json:默认
27+
- text
28+
- document
29+
- arraybuffer
30+
- stream:应该是Node only(IE上可以使用`ms-stream`)// 不确定
31+
- blob:browser only.
32+
33+
### nodejs中,axios设置responseType做了什么
File renamed without changes.

nodejs/http.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## responseType=stream的情况
2+

web-request/XMLHttpRequest.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# XHR
2+
与服务端交互,从服务端请求数据,实现页面的局部更新
3+
4+
## 构造函数
5+
```js
6+
const request = new XMLHttpRequest();
7+
```
8+
9+
## responseType
10+
个人理解:responseType将返回的数据转换成指定的类型。相当于一个类型转换的过程,如果responseType的值与后端返回的数据类型对不上,解析数据就会出错。
11+
12+
网上有说法:responseType告诉后端服务器要返回的数据类型,无法印证。猜测服务器并不关心甚至无法获取这个responseType
13+
14+
- text: 默认,DOMString对象中的文本
15+
- arraybuffer: 一个包含二进制数据的 JavaScript ArrayBuffer
16+
- blob:一个包含二进制数据的 Blob对象
17+
- json
18+
- document
19+
20+
21+
备注: 将 responseType 设置为特定值时,开发人员应确保服务器实际发送的响应与该格式兼容。如果服务器返回的数据与设置的 responseType 不兼容,则 response 的值将为null .
22+
23+
File renamed without changes.
File renamed without changes.
File renamed without changes.

web-request/web-worker.md

Whitespace-only changes.

工作.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## 原则
2+
1. 态度端正,坦诚,客观的面对需求,产品和客户
3+
2. 及时响应与反馈,及早暴漏问题和风险,立即回消息,总之及时响应
4+
2. 工作中不带入私人情绪
5+
3. 根据公司文化,调整工作习惯
6+
1. 上班时间:提高效率,满载工作;下班时间:把时间花在自己身上,提升自己
7+
8+
### 中软华泰工作
9+
1. 上班写计划,下班提交代码,写当天工作日报
10+
2. 晨会详细说明自己前一天的工作内容,不要怕麻烦
11+
2. 规范操作每个迭代的jira单
12+
3. 与各个角色间规范操作:群里沟通,邮件沟通
13+
14+
## 8月记录
15+
### 二周
16+
- 20220810: 跟进底稿导出的问题和演示,然后排查任务记录红点的问题
17+
- 20220811: 修改底稿目录定位到具体位置的问题,和一个已知的bug
18+
- 20220812:移动端底稿管理员审批节点附件下载的问题
19+
### 三周
20+
- 20220815: 排查和修改缓存路由参数中字符串和数字转换导致的bug,
21+
- 20220816: 排查底稿空间复制文件的bug,改底稿导出暂停的问题
22+
- 20220817:修改了一个通用组件,排查修改了两个近期合并导致的问题
23+
- 20220818:改底稿导出暂停,任务记录页面修改
24+
- 20220819:底稿导出的暂停和继续功能,自测和跟进测试。然后看了底稿导出下载需要优化的问题
25+
### 四周
26+
- 20220822:增加了底稿导出任务状态自动更新到前台,修改了等待时间长的问题,然后做了自测
27+
- 20220823: 修改平台跳转链接,修改任务完成通知的bug
28+
- 20220824: 验证和跟进底稿通知的bug,和调整链接的自测
29+
- 20330825: 开始改一键下载修改文件流的问题
30+
31+
// delay
32+
- 20220816: 计划是按修改通用组件的UI样式
33+
---- 归集任务通知到前端界面

0 commit comments

Comments
 (0)