Skip to content

Instantly share code, notes, and snippets.

View jakubriedl's full-sized avatar

Jakub Riedl jakubriedl

View GitHub Profile
@jakubriedl
jakubriedl / batchFetchExchange.ts
Last active June 10, 2023 04:13
URQL batchFetchExchange
import DataLoader from 'dataloader'
import { Exchange, Operation } from 'urql'
import { pipe, map } from 'wonka'
interface BatchRequest {
url: string
options?: RequestInit
}
const batchFetch = (
@jakubriedl
jakubriedl / 1asyncawait.js
Last active March 30, 2022 02:45 — forked from phuctm97/1asyncawait.js
Use Go Channels as Promises and Async/Await
// Javascript.
const one = async () => {
// Simulate a workload.
sleep(Math.floor(Math.random() * Math.floor(2000)))
return 1
}
const two = async () => {
// Simulate a workload.