This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The if-else pattern is replaced by if-only expressions for consisitency and clarity. | |
// A new JavaScript program or subprogram is executed, a initial task is created | |
taskQueue.enqueue(initParse()) | |
// Event Loop | |
while everyTick { | |
if !callstack.isEmpty() {continue} | |
taskQueue.dequeue().excuteStepsByJSEngine() | |
while !microTaskQueue.isEmpty() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see -> https://www.typescriptlang.org/docs/handbook/2/keyof-types.html | |
type ExcludeUnexpectedNumIdxSigKeyof<T> = keyof T extends number | |
? keyof T | |
: Extract<keyof T, string>; | |
type MapishMixed = { [k: number | string]: boolean }; | |
type M = ExcludeUnexpectedNumIdxSigKeyof<MapishMixed>; | |
// ^? M will be of type string | number | |
type MapishNumber = { [k: number]: boolean }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see -> https://en.wikipedia.org/wiki/Proxy_auto-config#:~:text=A%20proxy%20auto%2Dconfig%20(PAC,for%20fetching%20a%20given%20URL. | |
// 定义 findProxyForURL 函数,它接受初始化状态和配置文件 | |
const findProxyForURL = (init, profiles) => (url, host) => { | |
let result = init; | |
const scheme = url.substr(0, url.indexOf(":")); | |
do { | |
result = profiles[result]; | |
if (typeof result === "function") { | |
result = result(url, host, scheme); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env pwsh | |
# Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. | |
# TODO(everyone): Keep this script simple and easily auditable. | |
$ErrorActionPreference = 'Stop' | |
if ($v) { | |
$Version = "v${v}" | |
} | |
if ($Args.Length -eq 1) { |
OlderNewer