Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify & clean up viewers #53

Merged
merged 10 commits into from
Jan 13, 2022
Merged

Simplify & clean up viewers #53

merged 10 commits into from
Jan 13, 2022

Conversation

mk
Copy link
Member

@mk mk commented Jan 13, 2022

Simplify the viewer api by dropping the macros and requiring users to quote the :render-fn. This should make it explicit and less magic as to what part of the viewers is evaluated on the JVM and what is sent over the wire to run in the browser.

@mk
Copy link
Member Author

mk commented Jan 13, 2022

@zampino @philomates if either of you want to look over this before I merge it, please do.

Copy link
Contributor

@philomates philomates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Comment on lines +12 to +14
#?@(:cljs [IFn
(-invoke [this x] ((:f this) x))
(-invoke [this x y] ((:f this) x y))]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so on the :clj side we no longer want to implement IFn, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right.

@@ -153,7 +145,7 @@

(def elide-string-length 100)

(declare with-viewer*)
(declare with-viewer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line can be removed completely

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, dropped it in ac9dee5.

@@ -219,42 +211,16 @@
{:pred string? :render-fn (quote v/string-viewer) :fetch-opts {:n 100}}
{:pred number? :render-fn '(fn [x] (v/html [:span.tabular-nums (if (js/Number.isNaN x) "NaN" (str x))]))}])

(defn process-fns [viewers]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@mk mk merged commit e4acb37 into main Jan 13, 2022
@mk mk deleted the simplify-viewers branch January 13, 2022 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants