0.0.7 • Published 2 years ago

clj-browser-eval v0.0.7

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

clj-browser-eval

This is a thing that lets you turn any HTML input field into a Clojure interpreter.

clj-browser-eval.gif

CodePen: https://codepen.io/nichelodean/pen/zYWEgeW

quick start

In your html:

<script src="https://cdn.jsdelivr.net/npm/clj-browser-eval@0.0.7/dist/index.js"></script>

<div clj-interpreter>
  <textarea clj-code></textarea>
  <button clj-eval>Evaluate</button>
  <pre clj-result></pre>
</div>

clj-interpreter marks the container div for an interpreter

clj-code marks the text input that you want to use as the input for the interpreter

clj-eval designates the button (or any clickable thing) that you want to use to trigger evaluation

clj-result (optional - results will be window.alert'ed if this is not provided) designates where the result should go

multiple interpreters on one page

You can do as many of these on a page as you like!

<script src="https://cdn.jsdelivr.net/npm/clj-browser-eval@0.0.7/dist/index.js"></script>

<div clj-interpreter>
  <textarea clj-code></textarea>
  <button clj-eval>Evaluate</button>
  <pre clj-result></pre>
</div>

<div clj-interpreter>
  <textarea clj-code></textarea>
  <button clj-eval>Evaluate</button>
  <pre clj-result></pre>
</div>

<div clj-interpreter>
  <textarea clj-code></textarea>
  <button clj-eval>Evaluate</button>
  <pre clj-result></pre>
</div>

installing with npm

npm install clj-browser-eval

some considerations

I have no idea what I'm doing and you should not use this for anything real.

credits

Made possible by scittle!

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago