binaryage / binaryage/cljs-devtools

Feature: String with metadata mode

オープン
#57 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Clojure
スター
1.1k
フォーク
51
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

issue には実装ファイルもテストも記載されていません。まず js/console.log のパスと cljs-devtools による値の処理を追跡し、次に提案されている data-str メタデータアプローチを評価してください。cljs-devtools なしで限定されたシリアライズが機能し、インストール済みの cljs-devtools で関連データを掘り下げられれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
clojure, javascript, react-native
領域
devtools
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
20/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。