viebel / klipse

Klipse is a JavaScript plugin for embedding interactive code snippets in tech blogs.
http://blog.klipse.tech/
GNU General Public License v3.0
3.1k stars 153 forks source link

Any way to evaluate a snippet only when a button is clicked? (not evaluate all the time) #402

Open NLKNguyen opened 2 years ago

NLKNguyen commented 2 years ago

This is amazing. The only issue that seems obvious but I can't find an answer is how to trigger the snippet evaluation only when the user clicks a button (similar to Leetcode's RUN button or any JS IDE in browser really).

From my observation, auto evaluation is more of a risk than a feature. I can't imagine any use case for auto evaluation except for demonstrating simple stateless expressions. Beyond that, it gets very strange, e.g. a snippet of SQL insert statements that keep inserting to the table as I'm still writing, the typical infinite loop issue when I haven't finished writing the loop body yet, etc.

Is there any way to turn off auto evaluation and trigger only when a button is clicked?

Thanks for the awesome work!