diff options
author | 2022-12-02 20:48:57 -0800 | |
---|---|---|
committer | 2022-12-02 20:48:57 -0800 | |
commit | fe4f39fd17b8ffbb809871b9e4c6550063f15657 (patch) | |
tree | 94e3b98898cd9d8b62804cec72fc81776a841135 /src/bun.js/bindings/ScriptExecutionContext.h | |
parent | 9cc03cd71a2e42b489b8b0c837cdb0d1b1d3fa0b (diff) | |
download | bun-fe4f39fd17b8ffbb809871b9e4c6550063f15657.tar.gz bun-fe4f39fd17b8ffbb809871b9e4c6550063f15657.tar.zst bun-fe4f39fd17b8ffbb809871b9e4c6550063f15657.zip |
Add `AbortSignal.timeout`
Diffstat (limited to 'src/bun.js/bindings/ScriptExecutionContext.h')
-rw-r--r-- | src/bun.js/bindings/ScriptExecutionContext.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bun.js/bindings/ScriptExecutionContext.h b/src/bun.js/bindings/ScriptExecutionContext.h index 1643820dd..5f6c56a90 100644 --- a/src/bun.js/bindings/ScriptExecutionContext.h +++ b/src/bun.js/bindings/ScriptExecutionContext.h @@ -132,6 +132,15 @@ public: reinterpret_cast<Zig::GlobalObject*>(m_globalObject)->queueTask(task); } // Executes the task on context's thread asynchronously. + void postTaskOnTimeout(EventLoopTask* task, Seconds timeout) + { + reinterpret_cast<Zig::GlobalObject*>(m_globalObject)->queueTaskOnTimeout(task, static_cast<int>(timeout.milliseconds())); + } // Executes the task on context's thread asynchronously. + void postTaskOnTimeout(Function<void(ScriptExecutionContext&)>&& lambda, Seconds timeout) + { + auto* task = new EventLoopTask(WTFMove(lambda)); + postTaskOnTimeout(task, timeout); + } template<typename... Arguments> void postCrossThreadTask(Arguments&&... arguments) { |