Skip to content

Instantly share code, notes, and snippets.

@Debbl
Debbl / 1.txt
Created September 3, 2021 16:19
test
你好
# http://editorconfig.org
root = true
[*] # 表示所有文件适用
charset = utf-8 # 设置文件字符集为 utf-8
indent_style = space # 缩进风格(tab | space)
indent_size = 2 # 缩进大小
end_of_line = lf # 控制换行类型(lf | cr | crlf)
trim_trailing_whitespace = true # 去除行首的任意空白字符
{
"compilerOptions": {
// 目标代码 esnext 是指 es6 以后
// 交给 Babel 来转化 根据 browserslistrc
"target": "esnext",
// 目标代码使用的模块化方案 umd 支持多种模块化
"module": "esnext",
// 严格模式 'use strict'
"strict": true,
// 对 jsx 进行怎么样的处理 preserve 保持默认
@Debbl
Debbl / gist:cc1054545b4f843708b79642cb58853e
Created February 27, 2022 12:36
git-config-global-list
/**
- https 代理
- 用户名
- 邮箱
- 中文乱码
*/
https.proxy=http://127.0.0.1:10808
user.name=Debbl
user.email=me@aiwan.run
const path = require('path');
const { merge } = require('webpack-merge');
const { DefinePlugin } = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ESLintPlugin = require('eslint-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
// https://promisesaplus.com/
// 状态定义
const PROMISE_STATUS_PENDING = 'pending';
const PROMISE_STATUS_FULFILLED = 'fulfilled';
const PROMISE_STATUS_REJECTED = 'rejected';
class MYPromise {
constructor(executor) {

宏任务和微任务

宏任务队列(macrotask queue)

  • ajax
  • setTimeout
  • setInterval
  • DOM 监听
  • UI Rendering 等
@Debbl
Debbl / JS模块化.md
Last active March 11, 2022 08:15
JavaScript的模块化

CommonJS 模块化

导出

  • 导出的是对象的引入,指向同一个对象
  • exports={} 是错误的
module.exports = {};
exports.name = name;
// 重点 最终导出的一定的是 module.exports
exports = {} // 这个导出是错误的,exports 指向了其他的对象,无法修改 module.epxorts 所指向的对象
// 源码中
@Debbl
Debbl / 01_基本实现.js
Last active March 18, 2022 07:50
手写防抖函数
function debounce(fn, delay) {
// 定时器,保留上一个触发的定时器
let timer = null;
const _debounce = function () {
// 没有达到延时,在次触发,清空上一次的定时器,不执行 fn
if (timer) clearTimeout(timer);
// 定时器
timer = setTimeout(() => {
fn();
}, delay);
@Debbl
Debbl / README.md
Last active March 24, 2022 07:35
从零搭建React开发环境

1. 初始化

npm init

2. git 初始化

git init

3. 安装 React 和 ReactDOM