本文主要作为平时在 TypeScript 代码中编写类型以及对 TypeScript 代码进行 review 时候的参考手册,并非强制执行的规范,也不涉及纯代码风格以及代码逻辑上的指导。
本文内容参考了下面几个手册,所以强烈建议能够同时阅读完这几个手册。如果大家对 TypeScript 的一些基础用法和特性还不熟悉,也建议先阅读第一个 TypeScript 手册。
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| </head> | |
| <body> | |
| <canvas id="foo" width="300" height="300"></canvas> | |
| <script |
| const { Octokit } = require('@octokit/rest'); | |
| const octokit = new Octokit({ | |
| // auth: '' | |
| }); | |
| const OWNER = 'apache'; | |
| const REPO = 'incubator-echarts'; | |
| const MILESTONE = 21; |
| const glob = require('glob'); | |
| const child_process = require('child_process'); | |
| const util = require('util'); | |
| const exec = util.promisify(child_process.exec); | |
| glob('src/**/*.js', async (err, files) => { | |
| console.log(files); | |
| for (let file of files) { | |
| await exec(`git mv ${file} ${file.replace('.js', '.ts')}`); | |
| } |
| const fetch = require('node-fetch'); | |
| const MILESTONE_NUMBER = 15; | |
| function assembleIssues(issues) { | |
| return issues.map(issue => { | |
| if (issue.state === 'open') { | |
| return '#' + issue.number + ' ' + issue.title; | |
| } |
| /* | |
| * Copyright LWJGL. All rights reserved. | |
| * License terms: https://www.lwjgl.org/license | |
| */ | |
| /** | |
| * This is a 1:1 implementation/copy of the GLSL algorithm shown at the | |
| * end of the 2010 paper "Edge-Avoiding À-Trous Wavelet Transform for | |
| * fast Global Illumination Filtering" | |
| * | |
| * https://jo.dreggn.org/home/2010_atrous.pdf |
| const MIME = 'video/webm'; | |
| const MIME_CODEC = 'video/webm; codecs="vp8"'; | |
| const FILE_EXT = 'webm'; | |
| class CanvasRecorder { | |
| constructor() { | |
| this.recordedBlobs_ = []; | |
| this.mediaRecorder_ = null; |
| const echarts = require("echarts"); | |
| const Canvas = require('canvas'); | |
| const {JSDOM} = require('jsdom'); | |
| const fs = require('fs'); | |
| echarts.setCanvasCreator(() => { | |
| return new Canvas(100, 100); | |
| }); | |
| const {window} = new JSDOM(); | |
| global.window = window; |
| <html> | |
| <body> | |
| <canvas id="main" style="width:400px;height:400px;"></canvas> | |
| <script src="./dist/bundle.js"></script> | |
| </body> | |
| </html> |