From 857302a5ac0714087a1f8d068e3bc5a15a1393d8 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 3 Feb 2021 00:39:35 +0100 Subject: Move DevTools functions to `devtools-protocol.lisp` The `main.lisp` file was getting crowded. Move DevTools Protocol-related functions into a new file. --- l/src/devtools-protocol.lisp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 l/src/devtools-protocol.lisp (limited to 'l/src/devtools-protocol.lisp') 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)) -- cgit v1.2.3