- 用Web技术设计slides,让你的演讲充满交互性 https://revealjs.com/
- 用svelte编写高性能且清凉的交互式组件,用在React、Vue中 https://svelte.dev/
- 用headless ui + tailwindcss编写可以自定义样式的纯逻辑UI组件 https://tailwindcss.com/
- 用TypeScript4.0编写复杂类型,头脑体操 https://github.com/type-challenges
- Vue3 composition api和React hooks的异同
- jsx也能写业务逻辑?用jsx写rxjs pipeline
- 服务端也能实现的composition api?一种没有中间件的扁平化服务端模型
- WASM是什么?用后端语言Rust写一个前端demo
- webworker是什么?前端脚本无法操作DOM?尝试写一个基于worker的数据驱动的前端框架
- ESBuild太快了,为什么个人项目我放弃webpack + babel
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
Show hidden characters
{ | |
"defaultSeverity": "error", | |
"extends": [ | |
"tslint:recommended", | |
"tslint-config-airbnb", | |
"tslint-config-prettier" | |
], | |
"jsRules": {}, | |
"rules": { | |
... |
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
let hooks = []; | |
let hookIndex = 0; | |
let currentVNode = null; | |
let currentContainer = null; | |
function renderVNode(vnode) { | |
if (typeof vnode !== "object") return document.createTextNode(vnode); | |
if (typeof vnode.tag === "function") vnode = vnode.tag(vnode.props); | |
// init element | |
const node = document.createElement(vnode.tag); |
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
type Equals<A, B> = A extends B ? (B extends A ? true: false) : false | |
type Zero = "ZERO" | |
type AddOne<T> = () => T | |
type MinusOne<T> = T extends () => infer R ? R : never | |
type Add<A, B> = B extends Zero ? A : Add<AddOne<A>, MinusOne<B>> |
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
netsh winhttp set proxy http://xxxx | |
netsh winhttp reset proxy |
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
class MyPromise<T> { | |
status: "PENDING" | "FULFILLED" | "REJECTED" = "PENDING"; | |
subjects: { complete: (value: T) => void }[] = []; | |
result?: T; | |
constructor(executor: (resolve: (result: MyPromise<T> | T) => void) => void) { | |
const resolver = (result: MyPromise<T> | T) => { | |
if (result instanceof MyPromise) { | |
result.then(resolver); | |
} else { | |
this.result = result; |
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
function myAsync(generatorFactory) { | |
return (...args) => { | |
const generator = generatorFactory(...args); | |
const resolve = (result) => { | |
if (result.done) { | |
return Promise.resolve(result.value); | |
} | |
return Promise.resolve(result.value) | |
.then((resolvedValue) => resolve(generator.next(resolvedValue))) | |
.catch((error) => generator.throw(error)); |
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
import { fromEvent } from "rxjs"; | |
import { debounceTime, tap } from "rxjs/operators"; | |
const React = { | |
createElement(type, props, ...children) { | |
const operator = type.call(null, props); | |
if (children.length !== 0) { | |
return operator.pipe(...children); | |
} | |
return operator; |
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
// forked from https://github.com/ahejlsberg/tsconf2020-demos/blob/master/template/main.ts | |
type SubKeys<T, K extends string> = K extends keyof T ? `${K}.${PathKeys<T[K]>}` : never | |
type PathKeys<T> = object extends T | |
? string | |
: T extends readonly any[] | |
? Extract<keyof T, `${number}`> | SubKeys<T, Extract<keyof T, `${number}`>> | |
: T extends object | |
? Extract<keyof T, string> | SubKeys<T, Extract<keyof T, string>> | |
: never |
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
import React, { useCallback, useEffect, useRef, useState } from "react"; | |
import { timer } from "rxjs"; | |
import { take, map } from "rxjs/operators"; | |
type Subscription = { unsubscribe: () => void } | |
type Observable<T> = { subscribe: (next: (value: T) => void) => Subscription } | |
const useSubscriber = () => { | |
const [, forceRefresh] = useState({}); | |
const subscriptionsRef = useRef(new Map<Observable<any>, Subscription>()); |
OlderNewer