binaryage / binaryage/cljs-devtools
Feature: String with metadata mode
- Langage dominant
- Clojure
- Étoiles
- 1.1k
- Forks
- 51
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Aucun fichier d’implémentation ni test n’est indiqué dans l’issue. Commencez par suivre le chemin js/console.log et la gestion des valeurs par cljs-devtools, puis évaluez l’approche proposée fondée sur les métadonnées data-str ; le travail est terminé lorsque la sérialisation bornée fonctionne sans cljs-devtools et qu’un cljs-devtools installé peut explorer les données associées.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- clojure, javascript, react-native
- Domaine
- devtools
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 20/100