首页
壁纸
关于
发现大佬
Search
1
Oculus Quest2 无线投屏到PC
2,353 阅读
2
XBOX土耳其阿根廷购买教程
1,840 阅读
3
openwrt路由器安装uu加速器插件
1,507 阅读
4
Xbox Series X / S 开箱~~~~激动无比
1,244 阅读
5
完美决解win10 可以上网却显示无internet的bug
1,109 阅读
学习
QuantumultX
JavaScript
web3
react
Solidity
雅思
Azure
游戏
随笔
登录
/
注册
Search
标签搜索
javascript
XSX
js
游戏
xbox
css
游戏截图
Xbox Series X
刺客信条
刺客信条英灵殿
web3
雅思
学习
IELTS
教程
Xbox Series S
Steam
截图
英语
leetcode
Arthur
累计撰写
105
篇文章
累计收到
89
条评论
首页
栏目
学习
QuantumultX
JavaScript
web3
react
Solidity
雅思
Azure
游戏
随笔
页面
壁纸
关于
发现大佬
搜索到
61
篇与
学习
的结果
2023-07-26
关闭/刷新 网页时发送请求
关闭/刷新 网页时发送请求 有时候我们需要在用户离开页面的时候,做一些上报来记录用户行为。又或者是发送服务器ajax请求,通知服务器用户已经离开,比如直播间内的退房操作。 这里涉及到Window: beforeunload event The beforeunload event is fired when the window, the document and its resources are about to be unloaded. The document is still visible and the event is still cancelable at this point. This event enables a web page to trigger a confirmation dialog asking the user if they really want to leave the page. If the user confirms, the browser navigates to the new page, otherwise it cancels the navigation. 注意:Sticky activation is required. The user has to have interacted with the page in order for this feature to work. 发送移步请求会被浏览器abort ,有下面两种解决办法 Navigator: sendBeacon() method 会发送一个post 的fetch请求,及时浏览器关闭也会发出去,但是有64kb限制,而且只能在beforeunload 或者visibilitychange 中使用 其他事件中回调,会丢失数据。 只能发送post请求,无法自定义请求头 sendBeacon(url) sendBeacon(url, data) fetch 请求,keepalive The keepalive option can be used to allow the request to outlive the page. Fetch with the keepalive flag is a replacement for the Navigator.sendBeacon() API. 标记keepalive的fetch请求允许在页面卸载后执行。 const data = JSON.stringify({ time: performance.now() }); fetch(url, { method: 'POST', body: data, headers: { 'Content-Type': 'application/json' }, keepalive: true, });
2023年07月26日
17 阅读
0 评论
0 点赞
2023-03-22
让第一个可获得焦点的元素获得焦点
window.CommonUtil.toFocusChildNode = function (elements) { // e.g. // elements = [ // '.common-content .****', // '.common-content', // ]; let focusEle = null; for (let item of elements) { let focusable = $(item).find(':focusable:visible:not(:disabled):not([aria-disabled="true"]):not([tabindex="-1"])'); if (focusable.length > 0) { focusEle = focusable[0]; break; } } focusEle && focusEle.focus(); }
2023年03月22日
137 阅读
0 评论
0 点赞
2023-01-31
React componentWillUnmount 清除异步state操作
React componentWillUnmount 清除异步state操作 Can’t perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method. 原因: 通常是 react 组件已经从 DOM 中移除,但是我们在组件中做的一些异步操作还未结束,如:接口调用等,当其完成时,执行setState操作,而此时我们已经将改组件dom移除,从而导致上述问题。 解决办法: componentWillUnmount() { this.setState = (state, callback) => { return; } }
2023年01月31日
70 阅读
0 评论
0 点赞
IELTS 雅思口语笔记 - 2
IELTS 雅思口语笔记 - 2 不懂一定要问考官:sorry, what do u mean by that? Do u like... ? Do u often do sth..? DO / Have / Is / Are 第一步:需要正面回应 肯定答案: yes + 细节和例子 + 解释感受 yes, sure/yes, absolutely / that's a big yes / no doubt about that / well, I like to say so well, I don't hate sth(适合表达不确定喜不喜欢的奇怪的东西) 否定答案: no + 原因解释 + 其他个人选择 Not really / No, I don't think so / No, I'm afraid not. / Quite the opposite Even if If I had more free time ... 喜欢与否? I'm pretty into... I'm quite big/keep on... ...is surely my thing. I can never/don't usually say no to I've had enough of ... = I'm so sick of ... 受够了 ... is the real pain in the neck. 让人头疼的事 解释说明 Because + 句子 Because of + 名词成分 As/for/since + 句子 The main/major reason is... It's simply/actually/basically/mainly because... ......and that's exactly/partly why...... Did u ... when u were yang ? Yes, kind of. When I was 5 or 6, I spent a lot of time on doing sth Have/had a great time Wh-列举 (be/how)what kind of ...? Basically,... 最常见的清形; plus/also/on top of that/apart from that,.. 第二选项 Generally speaking/ most of the time,... 最常见的情形,At the same / from the time to time ... 第二选项 Well, mostly, the first one I like to....is A, because...other than that,... When was the last time u did ... Speaking of this, it brings my memory back to the time when I was doing ....时间较近的情形 Well, let me see, at about this time yesterday / last Sunday / Friday / month, I was doing ...时间较远的情形 后面 + 评价心情,态度 splendid / sensational / make my day Have u ever done ... ? 过去进行时 虚拟语气 Yes/ I have / No, I haven't If I could, I'd love to If that was the case, I'd be over the moon 肯定 + 过去进行时 否定 + 虚拟语气 不确定的未来 Would u like...? Do u like to be...? Wow, let me think, hmmm, the answer would be yes/no If that was the case, I'd be over the moon. 二选一 Do u like/prefer A or B? Which one do u prefer, A or B? Well, it depends / I'm not sure / I don't know. (Nether of them in fact.) Between the two, I'd go for + 比较级 Personally, I'd believe ... sounds like a much better choice to me. Comparatively speaking, it seems to me that... is like a more reasonable / sensible / preferable option. / .... is my preference. 最 Do u have a favorite ...? What's the most ... Favorite / the bast The best / the most popular / the most important... Favorite If u ask me,... will have to be my first choice. Since you asked, I believe ...is absolutely at the top of my favorite list. If I have to take a pick, I guess no one compares to ......
2022年11月21日
56 阅读
0 评论
0 点赞
IELTS 雅思阅读笔记 - 2 (7种填空题1-4)
IELTS 雅思阅读笔记 - 2 (7种填空题1-4) 填空题(7种) 1,表格题(table) 特征: 原词填空原则(适用于所有填空题) 遵循语法原则(适用于所有填空题),95%有顺序性 (乱序一般在第三篇) 解题步骤 读请题干,确认字数限制 观察表格 观察表头 画出定位词(空前空后) 预测空格词性和内容(n. adj. adv. v. 数字) 回原文定位,根据预测找答案 2,流程图(flow-chart) 特征: 100% 有顺序性 100% 集中出题 解题步骤 整体定位: 原文某段首句一般出现:process , procedure, stage, step, phase 用题目中的特征定位词(大写,缩写,数字) 3,图形题(diagram) 特征: 100% 集中出题 偶尔出现小范围乱序 解题步骤: 整体定位:用题目中的特征词定位(大写,缩写,数字) 4,笔记题(notes) 特征: 100%有顺序性 有时集中出题(看是否有小标题) 解题步骤: 如果有小标题,且小标题不是主题词,先尝试整体定位 按板块分类分析题目
2022年11月21日
52 阅读
0 评论
0 点赞
1
2
...
13