Debian Codegraph @

testing/web-platform/mozilla/tests/webgpu/common/framework/on_shutdown.js

raw
1 /**
2 * AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts
3 **/const shutdownTasks = []; /**
4 * Register a callback to be run during program shutdown (triggered, e.g., by the 'beforeunload'
5 * event when the webpage is being closed).
6 *
7 * Note such tasks should be synchronous functions; otherwise, they probably won't complete.
8 */
9 export function registerShutdownTask(task) {
10 shutdownTasks.push(task);
11 }
12
13 /** Run all shutdown tasks. Should only be called during program shutdown. */
14 export function runShutdownTasks() {
15 for (const task of shutdownTasks) {
16 task();
17 }
18 shutdownTasks.length = 0;
19 }