binaryage / binaryage/cljs-devtools

Feature: String with metadata mode

Đang mở
#57 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Clojure
Star
1.1k
Fork
51
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

This is a feature idea.

I'm looking for a way to make my js/console.log display cleanly with and without cljs-devtools installed.

## Motivating example

Today's job is a react native app. It's not always convenient to turn cljs-devtools on (e.g. two simulators) and it's helpful to look in the simulator logs sometimes (no cljs-devtool rendering).

## Problems
* js/console.log with regular clojure data types produces verbose/unreadable strings.
* logging (serializing) large data structures can cause UX lag

## Idea

Perhaps cljs-devtools could be adapted to look for metadata associated with a string (or string like) object.

Vaguely something like this could be used to prepare a "console.log friendly string" with some other protocol which cljs-devtools could detect...

```cljs
(defn data-str [data]
(binding [*print-level* 3 *print-length* 5]
(specify! (pr-str data) IMeta (-meta [_] data)))))

(js/console.log (data-str {:a 1 :b (range 1000)}))
```

NOTE: this code doesn't work

Goal is to cover two cases
* String form will work in all situations and not take too long to serialize.
* If cljs-devtools is installed you can drill into metadata.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Issue không nêu tệp triển khai hay bài kiểm thử nào. Hãy bắt đầu bằng cách lần theo đường dẫn js/console.log và cách cljs-devtools xử lý các giá trị, sau đó đánh giá phương pháp siêu dữ liệu data-str được đề xuất; được xem là hoàn tất khi việc tuần tự hóa có giới hạn hoạt động mà không cần cljs-devtools, đồng thời cljs-devtools đã cài đặt có thể đi sâu vào dữ liệu liên quan.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
clojure, javascript, react-native
Lĩnh vực
devtools
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
20/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.