10 2023 档案
摘要:Concurrency + Channel (CSP): Concurrency is a way to run operation in isolated thread, a way to better utilize the CPU resources and handle multi simu
阅读全文
摘要:function getData(d) { setTimeout(() => { if (typeof d "number") { run.next(d/2) } else { run.next(d) } }, 500) } function* gen() { var x = 1 + (yield
阅读全文
摘要:Table of Content Introudction to VMs CPU - Understanding the Pysical Machine VMs - Arrays, Objects, functions, prototype chains DepotExplorer: collect
阅读全文
摘要:Thunks Sync thunk: A blocker of code which has everything ready and can return the value directly. function add(x, y) { return x + y } const thunk = f
阅读全文
摘要:An example of callback implemnetation for handling async flow: function fakeAjax(url, cb) { var fake_responses = { file1: "The first text", file2: "Th
阅读全文
摘要:Let's say you're creating a component that has all the props of input but needs to add a label prop. You'll need to extend from the ComponentProps typ
阅读全文
摘要:1. Basic version of signals We have a basic version of signal: const stack = [] export function createSignal(value) { const subscribers = new Set(); c
阅读全文
摘要:import { Configuration, OpenAIApi } from "openai"; import { process } from './env'; const configuration = new Configuration({ apiKey: process.env.OPEN
阅读全文
摘要:Implement two functions of Signals createSignal: return a tuple with read function and wrtie function createEffect: accept a function which will be ex
阅读全文
摘要:Let’s make using the observers asynchronous! This way we can update the data and have multiple observers run asynchronously. class AsyncData { constru
阅读全文
摘要:PubSub is one of the most foundational patterns for reactivity. Firing an event out with publish() allows anyone to listen to that event subscribe() a
阅读全文