File
Blob: src/workerd/api/node/timers.h
| 1 | // Copyright (c) 2017-2022 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | #pragma once |
| 5 | |
| 6 | #include <workerd/jsg/jsg.h> |
| 7 | |
| 8 | #include <kj/common.h> |
| 9 | |
| 10 | namespace workerd::api { |
| 11 | |
| 12 | class Immediate; |
| 13 | |
| 14 | namespace node { |
| 15 | class TimersUtil final: public jsg::Object { |
| 16 | public: |
| 17 | TimersUtil() = default; |
| 18 | TimersUtil(jsg::Lock&, const jsg::Url&) {} |
| 19 | |
| 20 | jsg::Ref<Immediate> setImmediate(jsg::Lock& js, |
| 21 | jsg::Function<void(jsg::Arguments<jsg::Value>)> function, |
| 22 | jsg::Arguments<jsg::Value> args); |
| 23 | void clearImmediate(jsg::Lock& js, kj::Maybe<jsg::Ref<Immediate>> immediate); |
| 24 | |
| 25 | JSG_RESOURCE_TYPE(TimersUtil) { |
| 26 | JSG_METHOD(setImmediate); |
| 27 | JSG_METHOD(clearImmediate); |
| 28 | } |
| 29 | }; |
| 30 | |
| 31 | #define EW_NODE_TIMERS_ISOLATE_TYPES api::node::TimersUtil |
| 32 | } // namespace node |
| 33 | |
| 34 | } // namespace workerd::api |