This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import delay from 'delay'; | |
| async function fooActionCreator(){ | |
| try { | |
| const result = await Promise.race([ | |
| fetch('/data', {cancellation}), | |
| delay(10000).then(() => throw 'CANCELLED'), | |
| ]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async function fooActionCreator(){ | |
| const cancellation = createTimeoutCancellation(10000); | |
| try { | |
| const result = await Promise.race([ | |
| fetch('/data', {cancellation}), | |
| cancellation, | |
| ]); | |
| return {type: 'REQUEST_DONE', result}; |
NewerOlder