GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — opencode/packages/opencode/src/util/local-context.ts at dev · ngbrown/opencode Expand file tree/ Copy pathlocal-context.tsMore file actions 25 lines (22 loc) · 568 Bytes / Copy pathlocal-context.tsFile metadata and controls25 lines (22 loc) · 568 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 import { AsyncLocalStorage } from "async_hooks" export class NotFound extends Error { constructor(public override readonly name: string) { super(`No context found for ${name}`) } } export function create<T>(name: string) { const storage = new AsyncLocalStorage<T>() return { use() { const result = storage.getStore() if (!result) { throw new NotFound(name) } return result }, provide<R>(value: T, fn: () => R) { return storage.run(value, fn) }, } } export * as LocalContext from "./local-context" |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |