• postpostscript avatar
    disposable
    @postpostscript
    disposable: wrapper to make an object disposable with the using keyword using feature explanation in TypeScript 5.2 docs Example: import { disposable } from "https://esm.town/v/postpostscript/disposable"; using state = disposable( { x: 1, y: 2, }, (value) => console.log("state disposed", value), ); // state disposed { x: 1, y: 2, [Symbol(Symbol.dispose)]: [Function (anonymous)] } or, to use a proxy instead of modifying the original object: using state = disposable( { x: 1, y: 2, }, (value) => console.log("proxyState disposed", value), true, ); // proxyState disposed { x: 1, y: 2 } Full Example
    Script
  • pomdtr avatar
    http_client
    @pomdtr
    HTTP Client Attach a postman-like http client to your vals, with bookmarks and history support Usage Wrap your http handler in an the httpClient middleware. import {httpClient} from "https://esm.town/v/pomdtr/http_client" export default httpClient((req) => { return new Response("Hello World!") }) The http client will be shown on the root. Adding bookmarks You might want to bookmark some requests you need often. You can do it by passing a bookmark list as a middleware option: import {httpClient} from "https://esm.town/v/pomdtr/http_client" export default httpClient((req) => { return new Response("Hello World!") }, { bookmarks: [ { "label": "Dummy Request", "request": new Request("https://dummyjson.com/products") } ]}) Customizing the client path import {httpClient} from "https://esm.town/v/pomdtr/http_client" export default httpClient((req) => { return new Response("Hello World!") }, { path: "/http-client" }) TODO [ ] fix syntax highlighting on successive request [ ] allow to prefill the initial request
    HTTP (deprecated)
1
Next
April 26, 2024