node-tutorial
node-tutorial copied to clipboard
:relaxed:Some of the node tutorial -《Node学习笔记》
Bumps [electron](https://github.com/electron/electron) from 11.5.0 to 15.5.5. Release notes Sourced from electron's releases. electron v15.5.5 Release Notes for v15.5.5 Other Changes Backported fix for CVE-2022-1482. #34040 Backported fix for CVE-2022-1483. #34009...
Bumps [electron](https://github.com/electron/electron) from 11.5.0 to 15.5.5. Release notes Sourced from electron's releases. electron v15.5.5 Release Notes for v15.5.5 Other Changes Backported fix for CVE-2022-1482. #34040 Backported fix for CVE-2022-1483. #34009...
# 去抖 函数调用 n 秒后才会执行,如果函数在 n 秒内被调用的话则函数不执行,重新计算执行时间,这里的原理是利用了一个闭包,每当有事件被监听就清除闭包中`timer`,重新赋值 ```js // debounce function debounce(method, delay) { var timer = null; return function () { var context = this, args = arguments; clearTimeout(timer);...
# 安装code命令 打开VSC快捷键`⇧⌘P`打开命令行找到`shell command`选择`Shell Command: Install 'code' command in PATH command`安装 # 安装脚手架 执行完以下命令后,在VSC按`F5`,此时成功的话会打开一个新的调试窗口(扩展开发主机) ```bash npm install -g yo generator-code yo code # ? What type of extension do you...
# 调试网站 [AST测试网站](https://astexplorer.net/) [babel插件手册](https://github.com/jamiebuilds/babel-handbook/blob/master/translations/zh-Hans/plugin-handbook.md#toc-replacing-a-node) # babel ```js const template = require('@babel/template').default; const generate = require("@babel/generator").default; const ast = template.ast(` // JS var a = 'abcd' `); ast.kind = 'let'; ast.declarations[0].init.value...
# 安装证书 打开 Charles 的菜单 ```js Help—>SSL Proxying Setting—>Install Charles Root Certificate ```  这里注意新版本的 IOS 还需要设置如下: `关于本机 -> 证书信任设置 -> 针对根证书启用完全信任` 打开 Charles Proxy Ca 的证书  # 手机安装证书...
# promise 每一个异步请求立刻返回一个**Promise**对象,由于是立刻返回,所以可以采用同步操作的流程。而Promise的then方法,允许指定回调函数,在异步任务完成后调用 下面的setTimeout()可以代替理解为一个ajax请求,所以ajax请求同理 ```javascript function a() { return new Promise(function (resolve, reject) { setTimeout(function () { console.log('执行任务a'); resolve('执行任务a成功'); }, 1000); }); } function b(value) { console.log(value) return new Promise(function...
# 安装 [NPM](https://www.npmjs.com/)全局安装[TypeScript](https://www.npmjs.com/package/typescript)模块 ```bash npm install typescript -g ``` # 编译 TypeScript文件均以ts为后缀的文件,所以可以命名xxx.ts文件,并用命令行执行tsc xxx.tx ```ts tsc xxx.ts ``` # 类型 TypeScript支持与JavaScript几乎相同的数据类型,此外还提供了实用的枚举类型方便我们使用 ## 布尔值 最基本的数据类型就是简单的**true**/**false**值,在JavaScript和TypeScript里叫做**boolean** ```ts let bool: boolean = false; //=>...
# 安装 在命令行执行以下命令快速安装 ```javascript # Clone the repository $ git clone https://github.com/electron/electron-quick-start # Go into the repository $ cd electron-quick-start # Install dependencies $ npm install # Run the app...
# 声明方式 1、构造函数方式 ```js var reg = new RegExp('\d', 'gi'); ``` 2、字面量方式 ```js var reg = /\d/gi; ``` # 修饰符 修饰符有三种:`i, g, m` 可以同时出现,没有顺序(即 `gi` 与 `ig` 一样),请参考下方说明 |修饰符|说明| |-|-|...