aboutsummaryrefslogtreecommitdiffstats
path: root/l
diff options
context:
space:
mode:
authorTeddy Wing2021-02-03 00:39:35 +0100
committerTeddy Wing2021-02-03 00:39:35 +0100
commit857302a5ac0714087a1f8d068e3bc5a15a1393d8 (patch)
treefbdd4c2b8d3ec2c35c75fbf2ea631aa14b62e0f1 /l
parentd9ce7753973a2cb8f75332875bc6ddc456551967 (diff)
downloadextreload-857302a5ac0714087a1f8d068e3bc5a15a1393d8.tar.bz2
Move DevTools functions to `devtools-protocol.lisp`
The `main.lisp` file was getting crowded. Move DevTools Protocol-related functions into a new file.
Diffstat (limited to 'l')
-rw-r--r--l/extreload.asd1
-rw-r--r--l/src/devtools-protocol.lisp30
-rw-r--r--l/src/main.lisp29
3 files changed, 31 insertions, 29 deletions
diff --git a/l/extreload.asd b/l/extreload.asd
index 0dd04ed..551076e 100644
--- a/l/extreload.asd
+++ b/l/extreload.asd
@@ -10,6 +10,7 @@
(:file "macro")
(:file "config")
(:file "option")
+ (:file "devtools-protocol")
(:file "main"))))
:build-operation "program-op"
diff --git a/l/src/devtools-protocol.lisp b/l/src/devtools-protocol.lisp
new file mode 100644
index 0000000..41a408e
--- /dev/null
+++ b/l/src/devtools-protocol.lisp
@@ -0,0 +1,30 @@
+(in-package :extreload)
+
+(defun target-get-targets-msg (call-id)
+ (jsown:to-json
+ `(:obj ("id" . ,call-id)
+ ("method" . "Target.getTargets"))))
+
+(defun target-attach-to-target-msg (call-id target-id)
+ (jsown:to-json
+ `(:obj ("id" . ,call-id)
+ ("method" . "Target.attachToTarget")
+ ("params" . (:obj ("targetId" . ,target-id)
+ ("flatten" . t))))))
+
+(defun target-attached-to-target-msg-p (message)
+ (equal
+ (json-obj-get message "method")
+ "Target.attachedToTarget"))
+
+(defun runtime-evaluate-msg (call-id session-id expression)
+ (jsown:to-json
+ `(:obj ("id" . ,call-id)
+ ("sessionId" . ,session-id)
+ ("method" . "Runtime.evaluate")
+ ("params" . (:obj ("expression" . ,expression))))))
+
+(defun parse-get-targets-response (response)
+ (let* ((result (json-obj-get response "result"))
+ (targetInfos (json-obj-get result "targetInfos")))
+ targetInfos))
diff --git a/l/src/main.lisp b/l/src/main.lisp
index 6e74ab7..afa79d8 100644
--- a/l/src/main.lisp
+++ b/l/src/main.lisp
@@ -31,30 +31,6 @@
(wait-group:wait *wg*)))
-(defun target-get-targets-msg (call-id)
- (jsown:to-json
- `(:obj ("id" . ,call-id)
- ("method" . "Target.getTargets"))))
-
-(defun target-attach-to-target-msg (call-id target-id)
- (jsown:to-json
- `(:obj ("id" . ,call-id)
- ("method" . "Target.attachToTarget")
- ("params" . (:obj ("targetId" . ,target-id)
- ("flatten" . t))))))
-
-(defun target-attached-to-target-msg-p (message)
- (equal
- (json-obj-get message "method")
- "Target.attachedToTarget"))
-
-(defun runtime-evaluate-msg (call-id session-id expression)
- (jsown:to-json
- `(:obj ("id" . ,call-id)
- ("sessionId" . ,session-id)
- ("method" . "Runtime.evaluate")
- ("params" . (:obj ("expression" . ,expression))))))
-
(defun ws-on-message (message)
(let* ((response (jsown:parse message))
(targets (parse-get-targets-response response)))
@@ -71,11 +47,6 @@
(wait-group:done *wg*)))
-(defun parse-get-targets-response (response)
- (let* ((result (json-obj-get response "result"))
- (targetInfos (json-obj-get result "targetInfos")))
- targetInfos))
-
(defun json-obj-get (obj key)
(handler-case
(jsown:val obj key)