Loading

摘要: 回调 🚩 异步 行为(action):现在开始执行的行为,但它们会在稍后完成(例如,setTimeout 函数就是一个这样的函数;例如加载脚本和模块) 实际中的异步行为的示例: /** * 使用给定的 src 加载脚本 * @param src **/ function loadScript(sr 阅读全文
posted @ 2022-02-10 19:35 shanejix 阅读(70) 评论(0) 推荐(0)
摘要: API - subscribe / addListener / on - publish / emit - unsubscribe / removeListener / off EventEmitter class EventEmitter { constructor() { /** * 订阅中心 阅读全文
posted @ 2022-01-20 21:53 shanejix 阅读(37) 评论(0) 推荐(0)
摘要: React Router V5 file tree . ├── conponents └── Authentication.tsx ├── pages ├── Home.tsx ├── Login.tsx └── Management.tsx ├── routes ├── privateRoutes 阅读全文
posted @ 2022-01-19 21:56 shanejix 阅读(47) 评论(0) 推荐(0)
摘要: 本文参考 Promises/A+ 规范实现 new Promise(),.then()等功能,如不了解 Promise请参考《Promise 必知必会》。更具体的 Promises/A+ 规范见这里 demo 看一个测试代码test.js let promise1 = new Promise( (r 阅读全文
posted @ 2022-01-17 23:58 shanejix 阅读(43) 评论(0) 推荐(0)
摘要: 浏览器(多进程)其实就是是一个异步非阻塞模型的实现,当新建一个Tab 页面时,就会新开一个进程。一个 Tab 页面从加载到渲染需要在浏览器内核(多线程)的调度下控制各线程互相配合以保持同步。浏览器常驻线程包括:GUI 渲染线程,JavaScript 引擎线程,定时触发器线程,事件触发线程,异步 ht 阅读全文
posted @ 2022-01-14 18:20 shanejix 阅读(38) 评论(0) 推荐(0)
摘要: 各种原因,把备用机 MI6 刷成欧版 MIUI,大致流程差不多,记录下方便后续查阅 大致步骤如下: 数据备份 -> 解锁 -> 刷入Recover -> 刷入ROM -> 跳过Google验证 数据备份 数据是无价的!数据是无价的!数据是无价的! 手机变砖无所谓,重要数据一定要备份,诸如:照片,聊天 阅读全文
posted @ 2022-01-12 22:47 shanejix 阅读(3430) 评论(0) 推荐(0)
摘要: import fs from "fs-extra"; import axios from "axios"; export async function downloadFile( url: string, output: string, options?: {} ): Promise<string> 阅读全文
posted @ 2022-01-10 17:54 shanejix 阅读(92) 评论(0) 推荐(0)
摘要: const sleep = (milliseconds) => { return new Promise((resolve) => setTimeout(resolve, milliseconds)); }; usage: await sleep(1000); 阅读全文
posted @ 2022-01-10 17:54 shanejix 阅读(31) 评论(0) 推荐(0)
摘要: 执行 npm scripts命令突然报错如下: xx@ling:/usr/github_reps/block-ui# yarn run build:esm yarn run v1.22.10 $ block-scripts build:component:esm /usr/bin/env: ‘nod 阅读全文
posted @ 2022-01-06 20:47 shanejix 阅读(748) 评论(0) 推荐(0)
摘要: import { useState, useEffect } from "react"; export function useMediaQuery(query) { const [matches, setMatches] = useState(false); useEffect(() => { c 阅读全文
posted @ 2021-12-09 11:19 shanejix 阅读(96) 评论(0) 推荐(0)