Skip to content

Instantly share code, notes, and snippets.

View ujeenator's full-sized avatar
💭
I may be slow to respond.

Eugenus Optimus ujeenator

💭
I may be slow to respond.
View GitHub Profile
import delay from 'delay';
async function fooActionCreator(){
try {
const result = await Promise.race([
fetch('/data', {cancellation}),
delay(10000).then(() => throw 'CANCELLED'),
]);
async function fooActionCreator(){
const cancellation = createTimeoutCancellation(10000);
try {
const result = await Promise.race([
fetch('/data', {cancellation}),
cancellation,
]);
return {type: 'REQUEST_DONE', result};