The signal/controller pattern was introduced as the way to control ongoing
async work, initially for
cancellation via
AbortController
and
AbortSignal
.
This file contains 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
<script> | |
let abortProto = AbortController.prototype; | |
let oldAbort = AbortController.prototype.abort; | |
Object.assign(abortProto, { | |
abort(reason) { | |
oldAbort.call(this, reason); | |
if (this.signal.__dependents) { | |
for (let controller of this.signal.__dependents) { |
This file contains 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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<title>Test React Scheduler</title> | |
<script src="rs.js"></script> | |
<button onclick="runTest()">Run test</button> | |
<script> | |
const TEST_DURATION = 300000; |