aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/BunDebugger.cpp
diff options
context:
space:
mode:
authorGravatar Ashcon Partovi <ashcon@partovi.net> 2023-09-01 00:33:33 -0700
committerGravatar Ashcon Partovi <ashcon@partovi.net> 2023-09-01 00:33:33 -0700
commit1ff8155c2831b95b72fb9749b7e837df48893df6 (patch)
tree1d012fcdf637a3b7fa8ed051ad5dde0cd913aafd /src/bun.js/bindings/BunDebugger.cpp
parent40d749b480a00bbc63beaac16625c529709f1cd6 (diff)
downloadbun-1ff8155c2831b95b72fb9749b7e837df48893df6.tar.gz
bun-1ff8155c2831b95b72fb9749b7e837df48893df6.tar.zst
bun-1ff8155c2831b95b72fb9749b7e837df48893df6.zip
Add Bun.canReload event to inspector
Diffstat (limited to 'src/bun.js/bindings/BunDebugger.cpp')
-rw-r--r--src/bun.js/bindings/BunDebugger.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/bun.js/bindings/BunDebugger.cpp b/src/bun.js/bindings/BunDebugger.cpp
index f4a5f535a..046739923 100644
--- a/src/bun.js/bindings/BunDebugger.cpp
+++ b/src/bun.js/bindings/BunDebugger.cpp
@@ -452,6 +452,21 @@ extern "C" void Bun__ensureDebugger(ScriptExecutionContextIdentifier scriptId, b
}
}
+extern "C" void BunDebugger__willHotReload() {
+ if (debuggerScriptExecutionContext == nullptr) {
+ return;
+ }
+
+ debuggerScriptExecutionContext->postTaskConcurrently([](ScriptExecutionContext &context){
+ WTF::LockHolder locker(inspectorConnectionsLock);
+ for (auto& connections : *inspectorConnections) {
+ for (auto* connection : connections.value) {
+ connection->sendMessageToFrontend("{\"method\":\"Bun.canReload\"}"_s);
+ }
+ }
+ });
+}
+
JSC_DEFINE_HOST_FUNCTION(jsFunctionCreateConnection, (JSGlobalObject * globalObject, CallFrame* callFrame))
{
auto* debuggerGlobalObject = jsDynamicCast<Zig::GlobalObject*>(globalObject);